ChrisSamo632 commented on code in PR #6544:
URL: https://github.com/apache/nifi/pull/6544#discussion_r1014601005


##########
nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-restapi-processors/src/main/java/org/apache/nifi/processors/elasticsearch/ElasticsearchRestProcessor.java:
##########
@@ -117,13 +123,66 @@ default String getQuery(final FlowFile input, final 
ProcessContext context, fina
     }
 
     default Map<String, String> getUrlQueryParameters(final ProcessContext 
context, final FlowFile flowFile) {
+        return getUrlQueryParameters(context, flowFile != null ? 
flowFile.getAttributes() : null);
+    }
+
+    default Map<String, String> getUrlQueryParameters(final ProcessContext 
context, final Map<String, String> attributes) {
         return context.getProperties().entrySet().stream()
                 // filter non-null dynamic properties
                 .filter(e -> e.getKey().isDynamic() && e.getValue() != null)
                 // convert to Map of URL parameter keys and values
                 .collect(Collectors.toMap(
-                    e -> e.getKey().getName(),
-                    e -> 
context.getProperty(e.getKey()).evaluateAttributeExpressions(flowFile).getValue()
+                        e -> e.getKey().getName(),
+                        e -> 
context.getProperty(e.getKey()).evaluateAttributeExpressions(attributes).getValue()
                 ));
     }
+
+    String VERIFICATION_STEP_INDEX_EXISTS = "Elasticsearch Index Exists";
+
+    @Override
+    default List<ConfigVerificationResult> verify(final ProcessContext 
context, final ComponentLog verificationLogger, final Map<String, String> 
attributes) {

Review Comment:
   Sounds like you might have been confused by the NiFi `verify` process as I 
was the first time I reviewed this sort of thing (I think there was a 
documentation Jira raised off the back of a Slack conversation I started, but 
not sure it's been done yet)
   
   Verification in NiFi is an optional thing for users to test their 
processor/controller settings before enabling/starting their components to 
verify whether they've got things like connection details setup correctly. 
Here, I've set the "Index Exists Check" to `SUCCEED` whether the index exists 
or not, provided the connection to Elasticsearch works and the expected 
not/exists response is returned. So it's OK if the index doesn't exist (and I'd 
see that happening not just for templated indices but any index - the index 
could be created by the first use of `PutElasticsearchRecord`, for example)
   
   Verification in NiFi is **not** mandatory and if a verify check fails, it 
doesn't stop the user from enabling/starting their components - but here, it 
should pass whether or not the index exists provided the connection to 
Elasticsearch succeeds and there are no authentication issues - the user is 
given the opportunity to provide attribute values via the verification window, 
e.g. if they're using NiFi Expression Language to specify an index name at 
runtime from FlowFile attributes, they can simulate that in the UI for 
verification



-- 
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.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to