[
https://issues.apache.org/jira/browse/NIFI-6458?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16954188#comment-16954188
]
David commented on NIFI-6458:
-----------------------------
I am getting the same error using JsonQueryElasticsearch 1.9.2:
2019-10-17 14:28:24,956 ERROR [Timer-Driven Process Thread-30]
o.a.n.p.e.JsonQueryElasticsearch
JsonQueryElasticsearch[id=df3a8d1d-016c-1000-b41c-3b823049311e] Error
processing flowfile.: java.lang.ClassCastException: java.util.LinkedHas
hMap cannot be cast to java.lang.Integer
java.lang.ClassCastException: java.util.LinkedHashMap cannot be cast to
java.lang.Integer
at
org.apache.nifi.elasticsearch.ElasticSearchClientServiceImpl.search(ElasticSearchClientServiceImpl.java:299)
at sun.reflect.GeneratedMethodAccessor611.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at
org.apache.nifi.controller.service.StandardControllerServiceInvocationHandler.invoke(StandardControllerServiceInvocationHandler.java:87)
at com.sun.proxy.$Proxy131.search(Unknown Source)
at
org.apache.nifi.processors.elasticsearch.JsonQueryElasticsearch.onTrigger(JsonQueryElasticsearch.java:176)
at
org.apache.nifi.processor.AbstractProcessor.onTrigger(AbstractProcessor.java:27)
at
org.apache.nifi.controller.StandardProcessorNode.onTrigger(StandardProcessorNode.java:1162)
at
org.apache.nifi.controller.tasks.ConnectableTask.invoke(ConnectableTask.java:209)
at
org.apache.nifi.controller.scheduling.TimerDrivenSchedulingAgent$1.run(TimerDrivenSchedulingAgent.java:117)
at org.apache.nifi.engine.FlowEngine$2.run(FlowEngine.java:110)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
And this does look exactly like the other errors we encountered on the switch
to 7 re: the change in the total object.
> 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
> Labels: easyfix
> 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)