[ 
https://issues.apache.org/jira/browse/NIFI-3576?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16423065#comment-16423065
 ] 

ASF GitHub Bot commented on NIFI-3576:
--------------------------------------

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

    https://github.com/apache/nifi/pull/2601#discussion_r178635886
  
    --- Diff: 
nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-processors/src/main/java/org/apache/nifi/processors/elasticsearch/QueryElasticsearchHttp.java
 ---
    @@ -219,6 +256,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);
    +                routeQueryInfoRels.add(REL_FAILURE);
    +                routeQueryInfoRels.add(REL_RETRY);
    +                routeQueryInfoRels.add(REL_QUERY_INFO);
    +                this.relationships = routeQueryInfoRels;
    +
    +                this.queryInfoRouteStrategy = 
QueryInfoRouteStrategy.ALWAYS;
    +            }else if (NO_HITS.getValue().equalsIgnoreCase(newValue)) {
    +                final Set<Relationship> routeQueryInfoRels = new 
HashSet<>();
    +                routeQueryInfoRels.add(REL_SUCCESS);
    +                routeQueryInfoRels.add(REL_FAILURE);
    +                routeQueryInfoRels.add(REL_RETRY);
    +                routeQueryInfoRels.add(REL_QUERY_INFO);
    +                this.relationships = routeQueryInfoRels;
    +
    +                this.queryInfoRouteStrategy = QueryInfoRouteStrategy.NOHIT;
    +            }
    +            }else {
    --- End diff --
    
    This whole if-else should be wrapped in a check to see if the 
PropertyDescriptor is the Query Info Strategy property. Otherwise, changing any 
other property results in entering this final else clause, thereby resetting 
the Query Info Strategy to "Never".


> QueryElasticsearchHttp should have a "Not Found"/"Zero results" relationship
> ----------------------------------------------------------------------------
>
>                 Key: NIFI-3576
>                 URL: https://issues.apache.org/jira/browse/NIFI-3576
>             Project: Apache NiFi
>          Issue Type: Improvement
>            Reporter: Joseph Percivall
>            Assignee: Otto Fowler
>            Priority: Minor
>
> In the event of a successful call, QueryElasticsearchHttp always drops the 
> incoming flowfile and then emits pages of results to the success 
> relationship. If the search returns no results then no pages of results are 
> emitted to the success relationship. 
> The processor should offer other options for handling when there are no 
> results returned.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to