Yury Sergeev created NIFI-6458:
----------------------------------
Summary: 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
Affects Versions: 1.9.2
Environment: NiFi 1.9.2, Elasticsearch 7.1.1
Reporter: Yury Sergeev
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
(v7.6.14#76016)