Elasticsearch Java Client 9.2.0
Discover what changed in the 9.2.0 version of the Java client.
Map to NamedValue CompositeAggregation.sources
sources in CompositeAggregation was wrongly mapped as List<Map>, but the server doesn't actually accept more than one value, so the type has been changed to List<NamedValue>.
Action
Change the builder to use the correct type.
Example:
- Old
esClient.search(s -> s .aggregations("agg", a -> a .composite(c -> c .sources(Map.of("source", CompositeAggregationSource.of(cas -> cas...)))) ) ); - New
esClient.search(s -> s .aggregations("agg", a -> a .composite(c -> c .sources(NamedValue.of("source", CompositeAggregationSource.of(cas -> cas...)))) ) );
String to Double GetOverallBucketsRequest.overallScore
overallScore in GetOverallBucketsRequest was wrongly mapped as String, but the correct value to be sent to the server is Double, so the type has been changed to Double.
Action
Change the builder to use the correct type.
Example:
- Old
esClient.ml() .getOverallBuckets(b -> b .overallScore("2") ... ); - New
esClient.ml() .getOverallBuckets(b -> b .overallScore(2D) ... );
Level to NodeStatsLevel NodesStatsRequest.level
level in NodesStatsRequest was wrongly mapped as the Level enum, which did not match the values accepted by the server, so it has been replaced with NodeStatsLevel.
Action
Change the builder to use the correct enum.
Example:
- Old
esClient.nodes() .stats(s -> s .level(Level.Indices) ); - New
esClient.nodes() .stats(s -> s .level(NodeStatsLevel.Indices) );
TimeUnit to Time StreamsStatusRequest.masterTimeout
masterTimeout in StreamsStatusRequest was wrongly mapped as TimeUnit, but the correct value to be sent to the server is Time, so the type has been changed to Time.
Action
Change the builder to use the correct type.
Example:
esClient.streams()
.status(s -> s
.masterTimeout(Time.of(t -> t.time("10s")))
);
Jackson 3 implementation of the JSON object mapper
Following the stable release of the Jackson library version 3, the Jackson 3 implementation of object mapper is now available!
The default implementation will stay version 2 for now, so to try the new implementation replace JacksonJsonpMapper with Jackson3JsonpMapper.
Example with shortcut builder:
try (ElasticsearchClient client = ElasticsearchClient.of(e -> e
.jsonMapper(new Jackson3JsonpMapper())
.host("your-host")
.apiKey("your-api-keys"))) {
...
}
Nothing was deprecated in this version of the client.