|
27 | 27 | import co.elastic.clients.util.ObjectBuilder;
|
28 | 28 | import reactor.core.publisher.Mono;
|
29 | 29 |
|
| 30 | +import java.io.IOException; |
30 | 31 | import java.util.function.Function;
|
31 | 32 |
|
32 | 33 | import org.springframework.lang.Nullable;
|
@@ -56,8 +57,11 @@ public ReactiveElasticsearchClient withTransportOptions(@Nullable TransportOptio
|
56 | 57 | }
|
57 | 58 |
|
58 | 59 | @Override
|
59 |
| - public void close() throws Exception { |
60 |
| - transport.close(); |
| 60 | + public void close() throws IOException { |
| 61 | + // since Elasticsearch 8.16 the ElasticsearchClient implements (through ApiClient) the Closeable interface and |
| 62 | + // handles closing of the underlying transport. We now just call the base class, but keep this as we |
| 63 | + // have been implementing AutoCloseable since 4.4 and won't change that to a mere Closeable |
| 64 | + super.close(); |
61 | 65 | }
|
62 | 66 |
|
63 | 67 | // region child clients
|
@@ -127,7 +131,8 @@ public <T> Mono<GetResponse<T>> get(GetRequest request, Class<T> tClass) {
|
127 | 131 | // java.lang.Class<TDocument>)
|
128 | 132 | // noinspection unchecked
|
129 | 133 | JsonEndpoint<GetRequest, GetResponse<T>, ErrorResponse> endpoint = (JsonEndpoint<GetRequest, GetResponse<T>, ErrorResponse>) GetRequest._ENDPOINT;
|
130 |
| - endpoint = new EndpointWithResponseMapperAttr<>(endpoint, "co.elastic.clients:Deserializer:_global.get.Response.TDocument", |
| 134 | + endpoint = new EndpointWithResponseMapperAttr<>(endpoint, |
| 135 | + "co.elastic.clients:Deserializer:_global.get.Response.TDocument", |
131 | 136 | getDeserializer(tClass));
|
132 | 137 |
|
133 | 138 | return Mono.fromFuture(transport.performRequestAsync(request, endpoint, transportOptions));
|
@@ -172,7 +177,8 @@ public <T> Mono<MgetResponse<T>> mget(MgetRequest request, Class<T> clazz) {
|
172 | 177 |
|
173 | 178 | // noinspection unchecked
|
174 | 179 | JsonEndpoint<MgetRequest, MgetResponse<T>, ErrorResponse> endpoint = (JsonEndpoint<MgetRequest, MgetResponse<T>, ErrorResponse>) MgetRequest._ENDPOINT;
|
175 |
| - endpoint = new EndpointWithResponseMapperAttr<>(endpoint, "co.elastic.clients:Deserializer:_global.mget.Response.TDocument", |
| 180 | + endpoint = new EndpointWithResponseMapperAttr<>(endpoint, |
| 181 | + "co.elastic.clients:Deserializer:_global.mget.Response.TDocument", |
176 | 182 | this.getDeserializer(clazz));
|
177 | 183 |
|
178 | 184 | return Mono.fromFuture(transport.performRequestAsync(request, endpoint, transportOptions));
|
|
0 commit comments