elastic / elasticsearch

Free and Open Source, Distributed, RESTful Search Engine
https://www.elastic.co/products/elasticsearch
Other
1.22k stars 24.85k forks source link

JAVA API Client 8.1 - ElasticSearchSqlClient (Sql query json format result in UnsupportedOperationException) #85302

Closed 19hamxwin closed 2 years ago

19hamxwin commented 2 years ago

Elasticsearch Version

8.1.1

Installed Plugins

gson2.8.5,spring-boot2.3.12.RELEASE,lombok1.18.12,jackson-databind2.12.3

Java Version

bundled

OS Version

Windows10

Problem Description

I have created a ElasticsearchClient with the JacksonJsonpMapper transport. However, when I call the Sql query API using

QueryResponse queryResponse = elasticsearchClient.sql().query(new QueryRequest.Builder().query("some sql").build());

The request failed, due to java.lang.UnsupportedOperationException threw by co.elastic.clients.json.JsonpDeserializer.deserialize

After some debugging, I found out the exception was thrown when it was trying to deserialize the "row" attribute, more specifically is when it was trying to deserialize the second '[' in "rows":[[xxxxxxxxxxxxxxxxxxxxxx]].

Steps to Reproduce

Simple create a elasticsearchClient with JacksonJsonpMapper transport, and then do the following QueryResponse queryResponse = elasticsearchClient.sql().query(new QueryRequest.Builder().query("some sql").build()); it will always throw the UnsupportedOperaitonException

Logs (if relevant)

No response

astefan commented 2 years ago

@19hamxwin thank you for your report. Two things are worth being mentioned:

Please, have a look at the issue I mentioned above confirming it is the same problem and/or comment in that issue adding more relevant details. Thank you.