elasticsearch-java
elasticsearch-java copied to clipboard
IndicesStatsRequest throws json error when encountering large values
Java API client version
8.9.1
Java version
openJDK 17.0.8.1
Elasticsearch Version
7.17.6
Problem description
The Java Rest Client will throw a
co.elastic.clients.transport.TransportException : node: <redacted>, status: 200, [es/indices.stats] Failed to decode response
caused by
co.elastic.clients.json.JsonpMappingException: Error deserializing co.elastic.clients.elasticsearch._types.QueryCacheStats: jakarta.json.stream.JsonParsingException: Jackson exception: Numeric value (38167167154) out of range of int (-2147483648 - 2147483647)
when encountering large numbers. In my specific case this caused the problem:
cat status.json| jq '._all.primaries.query_cache.total_count' 38167167154
Edit: attached the status response JSON in a comment below
Hello! This was recently fixed in the API specification used to produce the Java code with this PR. Updating the client to a more recent version should solve the problem.