Java client: Jackson exception: Numeric value out of range of int

Hello,

I am using Java client version 7.17.4 (server is 7.17.0).
Executing the following code

ElasticsearchIndicesClient indicesClient = new ElasticsearchIndicesClient(transport);
indicesClient.stats(b -> b.index("name"));

produces the following exception:

Exception in thread "main" co.elastic.clients.json.JsonpMappingException: Error deserializing co.elastic.clients.elasticsearch._types.StoreStats: jakarta.json.stream.JsonParsingException: Jackson exception: Numeric value (5104343339) out of range of int
 at [Source: (org.apache.http.nio.entity.ContentInputStream); line: 1, column: 176] (JSON path: _all.primaries.store.size_in_bytes) (line no=1, column no=176, 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:206)
	at co.elastic.clients.json.ObjectDeserializer.deserialize(ObjectDeserializer.java:136)
	at co.elastic.clients.json.JsonpDeserializer.deserialize(JsonpDeserializer.java:75)
	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:71)
	at co.elastic.clients.json.ObjectDeserializer.deserialize(ObjectDeserializer.java:180)
	at co.elastic.clients.json.ObjectDeserializer.deserialize(ObjectDeserializer.java:136)
	at co.elastic.clients.json.JsonpDeserializer.deserialize(JsonpDeserializer.java:75)
	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:71)
	at co.elastic.clients.json.ObjectDeserializer.deserialize(ObjectDeserializer.java:180)
	at co.elastic.clients.json.ObjectDeserializer.deserialize(ObjectDeserializer.java:136)
	at co.elastic.clients.json.JsonpDeserializer.deserialize(JsonpDeserializer.java:75)
	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:71)
	at co.elastic.clients.json.ObjectDeserializer.deserialize(ObjectDeserializer.java:180)
	at co.elastic.clients.json.ObjectDeserializer.deserialize(ObjectDeserializer.java:136)
	at co.elastic.clients.json.JsonpDeserializer.deserialize(JsonpDeserializer.java:75)
	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.rest_client.RestClientTransport.decodeResponse(RestClientTransport.java:328)
	at co.elastic.clients.transport.rest_client.RestClientTransport.getHighLevelResponse(RestClientTransport.java:294)
	at co.elastic.clients.transport.rest_client.RestClientTransport.performRequest(RestClientTransport.java:147)
	at co.elastic.clients.elasticsearch.indices.ElasticsearchIndicesClient.stats(ElasticsearchIndicesClient.java:2061)
	at co.elastic.clients.elasticsearch.indices.ElasticsearchIndicesClient.stats(ElasticsearchIndicesClient.java:2078)
	at App.main(App.java:162)
Caused by: jakarta.json.stream.JsonParsingException: Jackson exception: Numeric value (5104343339) out of range of int
 at [Source: (org.apache.http.nio.entity.ContentInputStream); line: 1, column: 176]
	at co.elastic.clients.json.jackson.JacksonJsonpParser.convertException(JacksonJsonpParser.java:84)
	at co.elastic.clients.json.jackson.JacksonJsonpParser.getInt(JacksonJsonpParser.java:155)
	at co.elastic.clients.json.JsonpDeserializerBase$2.deserialize(JsonpDeserializerBase.java:121)
	at co.elastic.clients.json.JsonpDeserializerBase$2.deserialize(JsonpDeserializerBase.java:115)
	at co.elastic.clients.json.JsonpDeserializer.deserialize(JsonpDeserializer.java:75)
	at co.elastic.clients.json.ObjectDeserializer$FieldObjectDeserializer.deserialize(ObjectDeserializer.java:71)
	at co.elastic.clients.json.ObjectDeserializer.deserialize(ObjectDeserializer.java:180)
	... 28 more
Caused by: com.fasterxml.jackson.core.JsonParseException: Numeric value (5104343339) out of range of int
 at [Source: (org.apache.http.nio.entity.ContentInputStream); line: 1, column: 176]
	at com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:1804)
	at com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:663)
	at com.fasterxml.jackson.core.base.ParserBase.convertNumberToInt(ParserBase.java:869)
	at com.fasterxml.jackson.core.base.ParserBase._parseIntValue(ParserBase.java:801)
	at com.fasterxml.jackson.core.base.ParserBase.getIntValue(ParserBase.java:645)
	at co.elastic.clients.json.jackson.JacksonJsonpParser.getInt(JacksonJsonpParser.java:153)
	... 33 more

Is it a bug? Or am I doing something wrong?

Shouldn't members of StoreStats be long rather than int?

Thanks!

Anyone please?

Have you tried to update the version of the java api client?
I tried with version 8.2.2 and it worked.

May be you index size is not large enough? I examined current sources for java client at github and it uses int, not long.

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