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

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_r182498324
  
    --- Diff: 
nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-processors/src/main/java/org/apache/nifi/processors/elasticsearch/QueryElasticsearchHttp.java
 ---
    @@ -352,6 +414,15 @@ private int getPage(final Response getResponse, final 
URL url, final ProcessCont
                 JsonNode responseJson = parseJsonResponse(new 
ByteArrayInputStream(bodyBytes));
                 JsonNode hits = responseJson.get("hits").get("hits");
     
    +            if ( (hits.size() == 0 && queryInfoRouteStrategy == 
QueryInfoRouteStrategy.NOHIT)
    --- End diff --
    
    This part doesn't quite work, not necessarily due to a logic error here, 
but it needs to be addressed either here or in the onTrigger do-while loop. If 
I don't set a limit and I set my page size to 20, then fetch all results (I 
have 100), then I get a flow file on the query-info connection. This is because 
the hitLimit variable is never set as the limit variable is always null, so we 
attempt to get all records starting from index 100, and zero are returned. 
However this code checks that hits.size() is zero (which it is the last time). 
No documents are output of course (due to the for-loop below), but the 
query-info flow file is sent. Perhaps this method needs to know the current 
total number of hits?


> 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