I am trying to use Elastic Java Client 8.8.0 (also known low-level rest client) and getting the error: status: 200, [es/search] Failed to decode response
I used the same library to create a new index and insert a new document and using the same POJO class to deserialize the document, found in the index, however no avail.
Here's the code fragment:
patDocument.setAddendum("abc");
patDocument.setDocumentName("docName");
patDocument.setAuthorName("RK");
patDocument.setId(3);
try {
IndexResponse response = esClient.index(i -> i
.index("patdocument-xxx")
.id(patDocument.getId() + "")
.document(patDocument)
);
} catch (IOException e) {
System.err.println(e.getMessage());
}
// ======= searching documents =======
SearchResponse<PatDocument2> response3=null;
try {
response3 = esClient.search(s -> s.index("patdocument-xxx")
.query(q -> q.match(t -> t.field("id").query("3"))), PatDocument2.class);
} catch (IOException e) {
System.err.println(e.getMessage());
}
System.out.println(response3);```
and this is the part of POJO:
co.elastic.clients.transport.TransportException: node: https://xxx:9443/, status: 200, [es/index] Failed to decode response
at co.elastic.clients.transport.ElasticsearchTransportBase.decodeTransportResponse(ElasticsearchTransportBase.java:345)
at co.elastic.clients.transport.ElasticsearchTransportBase.getApiResponse(ElasticsearchTransportBase.java:304)
at co.elastic.clients.transport.ElasticsearchTransportBase.performRequest(ElasticsearchTransportBase.java:111)
at co.elastic.clients.elasticsearch.ElasticsearchClient.index(ElasticsearchClient.java:1121)
at co.elastic.clients.elasticsearch.ElasticsearchClient.index(ElasticsearchClient.java:1138)
at Main.main(Main.java:53)
Caused by: co.elastic.clients.json.JsonpMappingException: Error deserializing co.elastic.clients.elasticsearch._types.ShardStatistics: jakarta.json.JsonException: Unable to get a JsonProvider. Check your classpath or thread context classloader. (JSON path: _shards.total) (line no=1, column no=91, offset=-1)
at co.elastic.clients.json.JsonpMappingException.from0(JsonpMappingException.java:134)
at co.elastic.clients.json.JsonpMappingException.from(JsonpMappingException.java:121)
at co.elastic.clients.json.ObjectDeserializer.deserialize(ObjectDeserializer.java:218)
at co.elastic.clients.json.ObjectDeserializer.deserialize(ObjectDeserializer.java:148)
at co.elastic.clients.json.JsonpDeserializer.deserialize(JsonpDeserializer.java:77)
at co.elastic.clients.json.ObjectBuilderDeserializer.deserialize(ObjectBuilderDeserializer.java:79)
at co.elastic.clients.json.DelegatingDeserializer$SameType.deserialize(DelegatingDeserializer.java:43)
at co.elastic.clients.json.ObjectDeserializer$FieldObjectDeserializer.deserialize(ObjectDeserializer.java:78)
at co.elastic.clients.json.ObjectDeserializer.deserialize(ObjectDeserializer.java:192)
at co.elastic.clients.json.ObjectDeserializer.deserialize(ObjectDeserializer.java:148)
at co.elastic.clients.json.JsonpDeserializer.deserialize(JsonpDeserializer.java:77)
at co.elastic.clients.json.ObjectBuilderDeserializer.deserialize(ObjectBuilderDeserializer.java:79)
at co.elastic.clients.json.DelegatingDeserializer$SameType.deserialize(DelegatingDeserializer.java:43)
at co.elastic.clients.transport.ElasticsearchTransportBase.decodeTransportResponse(ElasticsearchTransportBase.java:340)
... 5 more
Caused by: jakarta.json.JsonException: Unable to get a JsonProvider. Check your classpath or thread context classloader.
at co.elastic.clients.json.JsonpUtils.findProvider(JsonpUtils.java:85)
at co.elastic.clients.json.JsonpUtils.provider(JsonpUtils.java:55)
at co.elastic.clients.json.jackson.JsonValueParser.(JsonValueParser.java:43)
at co.elastic.clients.json.jackson.JacksonJsonpParser.getValue(JacksonJsonpParser.java:242)
at co.elastic.clients.json.JsonpDeserializerBase$8.deserialize(JsonpDeserializerBase.java:254)
at co.elastic.clients.json.JsonpDeserializerBase$8.deserialize(JsonpDeserializerBase.java:248)
at co.elastic.clients.json.JsonpDeserializer.deserialize(JsonpDeserializer.java:77)
at co.elastic.clients.json.ObjectDeserializer$FieldObjectDeserializer.deserialize(ObjectDeserializer.java:78)
at co.elastic.clients.json.ObjectDeserializer.deserialize(ObjectDeserializer.java:192)
... 16 more
Caused by: jakarta.json.JsonException: Provider org.eclipse.parsson.JsonProviderImpl not found
at jakarta.json.spi.JsonProvider.newInstance(JsonProvider.java:160)
at jakarta.json.spi.JsonProvider.provider(JsonProvider.java:144)
at co.elastic.clients.json.JsonpUtils.findProvider(JsonpUtils.java:65)
... 24 more
Caused by: java.lang.ClassNotFoundException: org.eclipse.parsson.JsonProviderImpl
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:375)
at jakarta.json.spi.JsonProvider.newInstance(JsonProvider.java:157)
... 26 more
co.elastic.clients.transport.TransportException: node: https://xxx:9443/, status: 200, [es/search] Failed to decode response
at co.elastic.clients.transport.ElasticsearchTransportBase.decodeTransportResponse(ElasticsearchTransportBase.java:345)
at co.elastic.clients.transport.ElasticsearchTransportBase.getApiResponse(ElasticsearchTransportBase.java:304)
at co.elastic.clients.transport.ElasticsearchTransportBase.performRequest(ElasticsearchTransportBase.java:111)
at co.elastic.clients.elasticsearch.ElasticsearchClient.search(ElasticsearchClient.java:1887)
at co.elastic.clients.elasticsearch.ElasticsearchClient.search(ElasticsearchClient.java:1904)
at Main.main(Main.java:66)
Caused by: co.elastic.clients.json.JsonpMappingException: Error deserializing co.elastic.clients.elasticsearch._types.ShardStatistics: jakarta.json.JsonException: Unable to get a JsonProvider. Check your classpath or thread context classloader. (JSON path: _shards.total) (line no=1, column no=51, offset=-1)
at co.elastic.clients.json.JsonpMappingException.from0(JsonpMappingException.java:134)
at co.elastic.clients.json.JsonpMappingException.from(JsonpMappingException.java:121)
at co.elastic.clients.json.ObjectDeserializer.deserialize(ObjectDeserializer.java:218)
at co.elastic.clients.json.ObjectDeserializer.deserialize(ObjectDeserializer.java:148)
at co.elastic.clients.json.JsonpDeserializer.deserialize(JsonpDeserializer.java:77)
at co.elastic.clients.json.ObjectBuilderDeserializer.deserialize(ObjectBuilderDeserializer.java:79)
at co.elastic.clients.json.DelegatingDeserializer$SameType.deserialize(DelegatingDeserializer.java:43)
at co.elastic.clients.json.ObjectDeserializer$FieldObjectDeserializer.deserialize(ObjectDeserializer.java:78)
at co.elastic.clients.json.ObjectDeserializer.deserialize(ObjectDeserializer.java:192)
at co.elastic.clients.json.ObjectDeserializer.deserialize(ObjectDeserializer.java:148)
at co.elastic.clients.json.JsonpDeserializer.deserialize(JsonpDeserializer.java:77)
at co.elastic.clients.json.ObjectBuilderDeserializer.deserialize(ObjectBuilderDeserializer.java:79)
at co.elastic.clients.json.DelegatingDeserializer$SameType.deserialize(DelegatingDeserializer.java:43)
at co.elastic.clients.json.DelegatingDeserializer$SameType.deserialize(DelegatingDeserializer.java:43)
at co.elastic.clients.transport.endpoints.EndpointWithResponseMapperAttr$1.deserialize(EndpointWithResponseMapperAttr.java:56)
at co.elastic.clients.transport.ElasticsearchTransportBase.decodeTransportResponse(ElasticsearchTransportBase.java:340)
... 5 more
Caused by: jakarta.json.JsonException: Unable to get a JsonProvider. Check your classpath or thread context classloader.
at co.elastic.clients.json.JsonpUtils.findProvider(JsonpUtils.java:85)
at co.elastic.clients.json.JsonpUtils.provider(JsonpUtils.java:55)
at co.elastic.clients.json.jackson.JsonValueParser.(JsonValueParser.java:43)
at co.elastic.clients.json.jackson.JacksonJsonpParser.getValue(JacksonJsonpParser.java:242)
at co.elastic.clients.json.JsonpDeserializerBase$8.deserialize(JsonpDeserializerBase.java:254)
at co.elastic.clients.json.JsonpDeserializerBase$8.deserialize(JsonpDeserializerBase.java:248)
at co.elastic.clients.json.JsonpDeserializer.deserialize(JsonpDeserializer.java:77)
at co.elastic.clients.json.ObjectDeserializer$FieldObjectDeserializer.deserialize(ObjectDeserializer.java:78)
at co.elastic.clients.json.ObjectDeserializer.deserialize(ObjectDeserializer.java:192)
... 18 more
Caused by: jakarta.json.JsonException: Provider org.eclipse.parsson.JsonProviderImpl not found
at jakarta.json.spi.JsonProvider.newInstance(JsonProvider.java:160)
at jakarta.json.spi.JsonProvider.provider(JsonProvider.java:144)
at co.elastic.clients.json.JsonpUtils.findProvider(JsonpUtils.java:65)
... 26 more
Caused by: java.lang.ClassNotFoundException: org.eclipse.parsson.JsonProviderImpl
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:375)
at jakarta.json.spi.JsonProvider.newInstance(JsonProvider.java:157)
... 28 more
Are there any source code examples (perhaps on github) that uses mvn or gradle for Elastic Java Client library (perhaps I am missing the proper version of some library or so).
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.