You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
jackson 2.x still supports java 7 and thus does not automatically
support java 8 classes. this will change with jackson 3.x (see e.g.
this [PR adding JSR310 date support] to 3.x).
PR opensearch-project#251 added documentation on how a custom `ObjectMapper` can be
registered - but there's no reason why we can't just enable
auto-detection centrally. the docs mention that performance should be
considered, but this is IMHO not relevant here since we only construct
it once and then keep the same `ObjectMapper` (which in turn the docs
mention as best practices).
Signed-off-by: Ralph Ursprung <[email protected]>
[PR adding JSR310 date support]: FasterXML/jackson-databind#5032
(cherry picked from commit c1ae512)
The `JacksonJsonpMapper` class (2.x versions) only supports Java 7 objects by default. [Java 8 modules](https://github.com/FasterXML/jackson-modules-java8) to support JDK8 classes such as the Date and Time API (JSR-310), `Optional`, and more can be used by including [the additional datatype dependency](https://github.com/FasterXML/jackson-modules-java8#usage) and adding the module. Auto-detection for these modules is enabled, adding them to the classpath is enough.
134
+
You can also provide your own `ObjectMapper` instance if you need to pre-configure it differently, for example:
135
+
136
+
```java
137
+
OpenSearchTransport transport =newRestClientTransport(restClient,
Upcoming OpenSearch `3.0.0` release brings HTTP/2 support and as such, the `RestClientTransport` would switch to HTTP/2 if available (for both HTTPS and/or HTTP protocols). The desired protocol could be forced using `RestClientBuilder.HttpClientConfigCallback`.
100
144
101
145
See [SampleClient.java](./samples/src/main/java/org/opensearch/client/samples/SampleClient.java) for a working sample.
0 commit comments