Elasticsearch Java Client 9.1.0
Discover what changed in the 9.1.0 version of the Java client.
Map to NamedValue Highlight.fields
fields
in Highlight
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 with SearchRequest
:
- Old
esClient.search(s -> s .index("*") .highlight(h -> h .fields(Map.of("highlighter-field", HighlightField.of(hf -> hf...))) ) ,Void.class);
- New
esClient.search(s -> s .index("*") .highlight(h -> h .fields(NamedValue.of("highlighter-field", HighlightField.of(hf -> hf...))) ) ,Void.class);
Map to List<Map> WeightedTokensQuery.tokens
tokens
in WeightedTokensQuery
was mapped as Map
, but the server can actually accept more than one map, so the type has been changed to List<Map>
.
Action
Nothing should be changed since the builders for List also accept a single value.
Class name change: IndicesBlockStatus -> AddIndicesBlockStatus in AddBlockResponse
IndicesBlockStatus
was renamed to AddIndicesBlockStatus
to avoid confusion with the new RemoveIndicesBlockStatus
Action
Replace the missing class with the new class name.
Opentelemetry update to stable conventions
Following the stable release of Opentelemetry's database conventions, the client was updated to use the correct attribute names. More details in the PR: https://github.com/elastic/elasticsearch-java/pull/1017
GetAliasResponse exception bug fix
GetAliasesResponse
is a special case because it can return both an exception and the actual response, in case 2 aliases, 1 present and 1 missing, are added to GetAliasesRequest
. The java client was unable to parse the response and used to throw a TransportException
, this was fixed by adding the additional alias information to the metadata
field in ErrorCause
:
try{
client.indices().getAlias(a -> a.name("test","test2"));
}
catch (ElasticsearchException e){
Map<String, JsonData> metadata = e.error().metadata();
JsonData index = metadata.get("example-index");
Map aliases = index.to(Map.class);
assertEquals("test", aliases.keySet().iterator().next());
}
More details in the PR: https://github.com/elastic/elasticsearch-java/pull/1041
Nothing was deprecated in this version of the client.