You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "Chris Sampson (Jira)" <ji...@apache.org> on 2020/11/27 17:14:00 UTC

[jira] [Commented] (NIFI-6458) ElasticSearchClientServiceImpl does not support Elasticserch 7 due to changes in search responses

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

Chris Sampson commented on NIFI-6458:
-------------------------------------

This seems to have been fixed (at least when I've run a JsonQueryElasticsearch against ES 7.10 from the current 1.13-SNAPSHOT build, it doesn't fail). Looks like it's been fixed for some time, but not sure which version of NiFi corrected it.

> ElasticSearchClientServiceImpl does not support Elasticserch 7 due to changes in search responses
> -------------------------------------------------------------------------------------------------
>
>                 Key: NIFI-6458
>                 URL: https://issues.apache.org/jira/browse/NIFI-6458
>             Project: Apache NiFi
>          Issue Type: Bug
>          Components: Core Framework, Extensions
>    Affects Versions: 1.9.2
>         Environment: NiFi 1.9.2, Elasticsearch 7.1.1
>            Reporter: Yury Sergeev
>            Priority: Minor
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> Due to the changes in Elasticsearch 7, now it returns a map, not Integer (see 'total.value' in the elastic 7 response), but the code in ElasticSearchClientServiceImpl.java expects to process an integer.
> line 264:
> int count = (Integer)hitsParent.get("total");
> Elastic 7 response example:
> {
>     "_shards": ...
>     "timed_out": false,
>     "took": 100,
>     "hits": \{
>         "max_score": 1.0,
>         "total" : {
>             "value": 2048,    
>             "relation": "eq"  
>         },
>         "hits": ...
>     }
> }
> Elastic 6 response example:
> {
>   "took" : 63,
>   "timed_out" : false,
>   "_shards" : \{
>     "total" : 5,
>     "successful" : 5,
>     "skipped" : 0,
>     "failed" : 0
>   },
>   "hits" : {
>     "total" : 1000,
>     "max_score" : null,
>     "hits" : [ {
> ...
> Therefore, the method of ElasticSearchClientServiceImpl search(String query, String index, String type) throws the following exception:
> java.lang.ClassCastException: java.util.LinkedHashMap cannot be cast to java.lang.Integer: java.lang.ClassCastException: java.util.LinkedHashMap cannot be cast to java.lang.Integer



--
This message was sent by Atlassian Jira
(v8.3.4#803005)