|
| 1 | +--- |
| 2 | +navigation_title: "9.2.0" |
| 3 | +--- |
| 4 | +# Elasticsearch Java Client 9.2.0 [elasticsearch-java-client-920] |
| 5 | + |
| 6 | +Discover what changed in the 9.2.0 version of the Java client. |
| 7 | + |
| 8 | +## Breaking changes [elasticsearch-java-client-920-breaking-changes] |
| 9 | + |
| 10 | +::::{dropdown} Map to NamedValue CompositeAggregation.sources |
| 11 | +`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>`. |
| 12 | + |
| 13 | +**Action**<br> Change the builder to use the correct type. |
| 14 | +Example: |
| 15 | +- Old |
| 16 | + ```java |
| 17 | + esClient.search(s -> s |
| 18 | + .aggregations("agg", a -> a |
| 19 | + .composite(c -> c |
| 20 | + .sources(Map.of("source", CompositeAggregationSource.of(cas -> cas...)))) |
| 21 | + ) |
| 22 | + ); |
| 23 | + ``` |
| 24 | +- New |
| 25 | + ```java |
| 26 | + esClient.search(s -> s |
| 27 | + .aggregations("agg", a -> a |
| 28 | + .composite(c -> c |
| 29 | + .sources(NamedValue.of("source", CompositeAggregationSource.of(cas -> cas...)))) |
| 30 | + ) |
| 31 | + ); |
| 32 | + ``` |
| 33 | + |
| 34 | +:::: |
| 35 | + |
| 36 | +::::{dropdown} String to Double GetOverallBucketsRequest.overallScore |
| 37 | +`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`. |
| 38 | + |
| 39 | +**Action**<br> Change the builder to use the correct type. |
| 40 | +Example: |
| 41 | +- Old |
| 42 | + ```java |
| 43 | + esClient.ml() |
| 44 | + .getOverallBuckets(b -> b |
| 45 | + .overallScore("2") |
| 46 | + ... |
| 47 | + ); |
| 48 | + ``` |
| 49 | +- New |
| 50 | + ```java |
| 51 | + esClient.ml() |
| 52 | + .getOverallBuckets(b -> b |
| 53 | + .overallScore(2D) |
| 54 | + ... |
| 55 | + ); |
| 56 | + ``` |
| 57 | +:::: |
| 58 | + |
| 59 | +::::{dropdown} Level to NodeStatsLevel NodesStatsRequest.level |
| 60 | +`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`. |
| 61 | + |
| 62 | +**Action**<br> Change the builder to use the correct enum. |
| 63 | +Example: |
| 64 | +- Old |
| 65 | + ```java |
| 66 | + esClient.nodes() |
| 67 | + .stats(s -> s |
| 68 | + .level(Level.Indices) |
| 69 | + ); |
| 70 | + ``` |
| 71 | +- New |
| 72 | + ```java |
| 73 | + esClient.nodes() |
| 74 | + .stats(s -> s |
| 75 | + .level(NodeStatsLevel.Indices) |
| 76 | + ); |
| 77 | + ``` |
| 78 | +:::: |
| 79 | + |
| 80 | +::::{dropdown} TimeUnit to Time StreamsStatusRequest.masterTimeout |
| 81 | +`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`. |
| 82 | + |
| 83 | +**Action**<br> Change the builder to use the correct type. |
| 84 | +Example: |
| 85 | +```java |
| 86 | +esClient.streams() |
| 87 | + .status(s -> s |
| 88 | + .masterTimeout(Time.of(t -> t.time("10s"))) |
| 89 | + ); |
| 90 | +``` |
| 91 | +:::: |
| 92 | + |
| 93 | + |
| 94 | +## Features and enhancements [elasticsearch-java-client-920-features-enhancements] |
| 95 | + |
| 96 | +::::{dropdown} Jackson 3 implementation of the JSON object mapper |
| 97 | +Following the stable release of the [Jackson library version 3](https://github.com/FasterXML/jackson/wiki/Jackson-Release-3.0), the Jackson 3 implementation of object mapper is now available! |
| 98 | +The default implementation will stay version 2 for now, so to try the new implementation replace `JacksonJsonpMapper` with `Jackson3JsonpMapper`. |
| 99 | +Example with shortcut builder: |
| 100 | +```java |
| 101 | +try (ElasticsearchClient client = ElasticsearchClient.of(e -> e |
| 102 | + .jsonMapper(new Jackson3JsonpMapper()) |
| 103 | + .host("your-host") |
| 104 | + .apiKey("your-api-keys"))) { |
| 105 | + ... |
| 106 | +} |
| 107 | +``` |
| 108 | +:::: |
| 109 | + |
| 110 | +## Deprecations [elasticsearch-java-client-920-deprecations] |
| 111 | + |
| 112 | +Nothing was deprecated in this version of the client. |
0 commit comments