Github user MikeThomsen commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/2601#discussion_r183417572
  
    --- Diff: 
nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-processors/src/main/java/org/apache/nifi/processors/elasticsearch/QueryElasticsearchHttp.java
 ---
    @@ -237,6 +265,39 @@ public void setup(ProcessContext context) {
             super.setup(context);
         }
     
    +    @Override
    +    public void onPropertyModified(final PropertyDescriptor descriptor, 
final String oldValue, final String newValue) {
    +        if (ROUTING_QUERY_INFO_STRATEGY.equals(descriptor)) {
    +            if (ALWAYS.getValue().equalsIgnoreCase(newValue)) {
    +                final Set<Relationship> routeQueryInfoRels = new 
HashSet<>();
    +                routeQueryInfoRels.add(REL_SUCCESS);
    --- End diff --
    
    You have a lot of duplicate code here. You could move:
    
    ```
    final Set<Relationship> routeQueryInfoRels = new HashSet<>();
    routeQueryInfoRels.add(REL_SUCCESS);
    routeQueryInfoRels.add(REL_FAILURE);
    routeQueryInfoRels.add(REL_RETRY);
    ```
    
    to before the if/else if blocks and then add `REL_QUERY_INFO` only in those 
two blocks. Also the `this.relationships` assignment could be done there as 
well.


---

Reply via email to