Skip to content

Commit 96016e7

Browse files
9.2 docs (#1097) (#1098)
* WIP * docs update * cleanup, link Co-authored-by: Laura Trotta <153528055+l-trotta@users.noreply.github.com>
1 parent d3d3ca1 commit 96016e7

File tree

6 files changed

+123
-2
lines changed

6 files changed

+123
-2
lines changed

docs/reference/setup/connecting.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ mapped_pages:
88
The Java API Client is structured around three main components:
99

1010
* **API client classes**. These provide strongly typed data structures and methods for {{es}} APIs. Since the {{es}} API is large, it is structured in feature groups (also called “namespaces”), each having its own client class. {{es}} core features are implemented in the `ElasticsearchClient` class.
11-
* **A JSON object mapper**. This maps your application classes to JSON and seamlessly integrates them with the API client. The default implementation uses Jackson.
11+
* **A JSON object mapper**. This maps your application classes to JSON and seamlessly integrates them with the API client. The default implementation uses Jackson version 2.
1212
* **A transport layer implementation**. This is where all HTTP request handling takes place. The [default implementation](/reference/transport/rest5-client/index.md) is based on the [Apache http client library](https://hc.apache.org/).
1313

1414
This code snippet uses the default configurations and only needs the location and credentials to connect to Elasticsearch:

docs/reference/transport/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ navigation_title: Transport layer
1414
The Java API client comes with two JSON mapping implementations:
1515

1616
* `JacksonJsonpMapper`, the default implementation based on the popular [Jackson](https://github.com/FasterXML/jackson) library.
17+
* `Jackson3JsonpMapper`, based on the new [Jackson](https://github.com/FasterXML/jackson) library version 3.
1718
* `JsonbJsonpMapper`, based on the JakartaEE JSONP specification, which allows using any implementation of this specification such as [Eclipse Parsson](https://github.com/eclipse-ee4j/parsson)
1819

1920
Which implementation should you use?

docs/release-notes/9-2-0.md

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
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.

docs/release-notes/index.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ To check for security updates, refer to [Security announcements for the Elastic
1212

1313
To check for issues, refer to [Known issues](../release-notes/known-issues.md).
1414

15+
## 9.2.0
16+
[Release notes](../release-notes/9-2-0.md)
17+
1518
## 9.1.0
1619
[Release notes](../release-notes/9-1-0.md)
1720

docs/release-notes/toc.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
toc:
22
- file: index.md
33
- file: known-issues.md
4+
- file: 9-2-0.md
45
- file: 9-1-0.md
56
- file: 9-0-4.md
67
- file: 9-0-0.md

rest5-client/src/main/java/co/elastic/clients/transport/rest5_client/low_level/Rest5Client.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,12 +276,16 @@ public boolean isRunning() {
276276
* exception this isn't always possible and likely haven't covered all of
277277
* the cases. You can get the original exception from
278278
* {@link Exception#getCause()}.
279+
* <p>
280+
* Differently from the legacy RestClient, this method does not throw exception
281+
* in case of 4xx errors from the server, since often the server returns 4xx exceptions with
282+
* bodies as part of the standard workflow.
279283
*
280284
* @param request the request to perform
281285
* @return the response returned by Elasticsearch
282286
* @throws IOException in case of a problem or the connection was aborted
283287
* @throws ClientProtocolException in case of an http protocol error
284-
* @throws ResponseException in case Elasticsearch responded with a status code that indicated an
288+
* @throws ResponseException in case Elasticsearch responded with a 5xx status code that indicated an
285289
* error
286290
*/
287291
public Response performRequest(Request request) throws IOException {

0 commit comments

Comments
 (0)