ChrisSamo632 commented on a change in pull request #4153:
URL: https://github.com/apache/nifi/pull/4153#discussion_r523806971



##########
File path: 
nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-processors/src/main/java/org/apache/nifi/processors/elasticsearch/AbstractElasticsearchHttpProcessor.java
##########
@@ -138,6 +150,18 @@
             
.expressionLanguageSupported(ExpressionLanguageScope.VARIABLE_REGISTRY)
             .build();
 
+    public static final PropertyDescriptor ES_VERSION = new 
PropertyDescriptor.Builder()
+            .name("elasticsearch-http-version")
+            .displayName("Elasticsearch Version")
+            .description("The major version of elasticsearch (this affects 
some HTTP query parameters and the way responses are parsed).")
+            .required(true)
+            .allowableValues(
+                    new 
AllowableValue(ElasticsearchVersion.ES_LESS_THAN_7.name(), "< 7.0", "Any 
version of Elasticsearch less than 7.0"),
+                    new AllowableValue(ElasticsearchVersion.ES_7.name(), 
"7.x", "Elasticsearch version 7.x"))
+            .defaultValue(ElasticsearchVersion.ES_LESS_THAN_7.name())
+            .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
+            .build();

Review comment:
       I'd probably suggest not having this property at all.
   
   Instead, change the processors so that they can support users calling 
different versions of ES and let ES deal with its own specific logic.
   
   For example, call ES 7 with a type (other than _doc) - it's actually still 
allowed but is deprecated and is warned about on the ES side (but would 
recommend not trying to relocate that logic in nifi as it'll be different again 
in later versions). This also means the change becomes a lot simpler - make 
_type optional and omit it from relevant ES calls. Maybe add/update 
documentation where appropriate (e.g. GET needs _doc or _source)




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to