Class cast exception in Rest High Level Client

(Anilkumar) #1

I have an index with one of the field type is double. Using Transport client, I am able to get data from api. When migrated to Rest High Level Client, I am getting below error.

    org.elasticsearch.ElasticsearchException: Elasticsearch exception [type=class_cast_exception, reason=java.lang.Long cannot be cast to java.lang.Double]
	at org.elasticsearch.ElasticsearchException.innerFromXContent( ~[elasticsearch-6.5.4.jar:6.5.4]
	at org.elasticsearch.ElasticsearchException.fromXContent( ~[elasticsearch-6.5.4.jar:6.5.4]
	at org.elasticsearch.ElasticsearchException.innerFromXContent( ~[elasticsearch-6.5.4.jar:6.5.4]
	at org.elasticsearch.ElasticsearchException.failureFromXContent( ~[elasticsearch-6.5.4.jar:6.5.4]
	at ~[elasticsearch-6.5.4.jar:6.5.4]
	at org.elasticsearch.client.RestHighLevelClient.parseEntity( ~[elasticsearch-rest-high-level-client-6.5.4.jar:6.5.4]
	at org.elasticsearch.client.RestHighLevelClient.parseResponseException( ~[elasticsearch-rest-high-level-client-6.5.4.jar:6.5.4]
	at org.elasticsearch.client.RestHighLevelClient.internalPerformRequest( ~[elasticsearch-rest-high-level-client-6.5.4.jar:6.5.4]
	at org.elasticsearch.client.RestHighLevelClient.performRequest( ~[elasticsearch-rest-high-level-client-6.5.4.jar:6.5.4]
	at org.elasticsearch.client.RestHighLevelClient.performRequestAndParseEntity( ~[elasticsearch-rest-high-level-client-6.5.4.jar:6.5.4]
	at ~[elasticsearch-rest-high-level-client-6.5.4.jar:6.5.4]

After modifying field type to Long, then api is working.

But I am able to retrieve for the same query from kibana without changing type. It means that the cast is not happening during fetch time with High Level Client.

Please let me know.

(Luca Cavanna) #2

that looks like a bug, could you recreate this and open an issue in the Elasticsearch repo please?

1 Like
(Anilkumar) #3

Please share me link, i will create it

(Luca Cavanna) #4
(system) closed #5

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.