mirror of
https://github.com/spring-projects/spring-data-elasticsearch.git
synced 2025-06-24 21:12:12 +00:00
Upgrade to Elasticsearch 8.3.3.
Original Pull Request #2244 Closes #2242
This commit is contained in:
parent
1f1076aa8b
commit
7620222f89
2
pom.xml
2
pom.xml
@ -21,7 +21,7 @@
|
||||
<!-- version of the RestHighLevelClient -->
|
||||
<elasticsearch-rhlc>7.17.5</elasticsearch-rhlc>
|
||||
<!-- version of the new ElasticsearchClient -->
|
||||
<elasticsearch-java>8.3.2</elasticsearch-java>
|
||||
<elasticsearch-java>8.3.3</elasticsearch-java>
|
||||
|
||||
<log4j>2.17.2</log4j>
|
||||
<netty>4.1.65.Final</netty>
|
||||
|
@ -29,15 +29,15 @@ Requires an installation of https://www.elastic.co/products/elasticsearch[Elasti
|
||||
[[preface.versions]]
|
||||
=== Versions
|
||||
|
||||
The following table shows the Elasticsearch versions that are used by Spring Data release trains and version of
|
||||
Spring Data Elasticsearch included in that, as well as the Spring Boot versions referring to that particular Spring
|
||||
Data release train. The Elasticsearch version given shows with which client libraries Spring Data Elasticsearch was
|
||||
The following table shows the Elasticsearch versions that are used by Spring Data release trains and version of
|
||||
Spring Data Elasticsearch included in that, as well as the Spring Boot versions referring to that particular Spring
|
||||
Data release train. The Elasticsearch version given shows with which client libraries Spring Data Elasticsearch was
|
||||
built and tested.
|
||||
|
||||
[cols="^,^,^,^,^",options="header"]
|
||||
|===
|
||||
| Spring Data Release Train | Spring Data Elasticsearch | Elasticsearch | Spring Framework | Spring Boot
|
||||
| 2022.0 (Turing) | 5.0.x | 8.3.2 | 6.0.x | 3.0.x?
|
||||
| 2022.0 (Turing) | 5.0.x | 8.3.3 | 6.0.x | 3.0.x?
|
||||
| 2021.2 (Raj) | 4.4.x | 7.17.3 | 5.3.x | 2.7.x
|
||||
| 2021.1 (Q) | 4.3.x | 7.15.2 | 5.3.x | 2.6.x
|
||||
| 2021.0 (Pascal) | 4.2.xfootnote:oom[Out of maintenance] | 7.12.0 | 5.3.x | 2.5.x
|
||||
@ -49,5 +49,5 @@ built and tested.
|
||||
| Ingallsfootnote:oom[] | 2.1.xfootnote:oom[] | 2.4.0 | 4.3.25 | 1.5.x
|
||||
|===
|
||||
|
||||
Support for upcoming versions of Elasticsearch is being tracked and general compatibility should be given assuming
|
||||
Support for upcoming versions of Elasticsearch is being tracked and general compatibility should be given assuming
|
||||
the usage of the <<elasticsearch.operations,ElasticsearchOperations interface>>.
|
||||
|
@ -1,7 +1,7 @@
|
||||
[[elasticsearch-migration-guide-4.4-5.0]]
|
||||
= Upgrading from 4.4.x to 5.0.x
|
||||
|
||||
This section describes breaking changes from version 4.4.x to 5.0.x and how removed features can be replaced by new
|
||||
This section describes breaking changes from version 4.4.x to 5.0.x and how removed features can be replaced by new
|
||||
introduced features.
|
||||
|
||||
[[elasticsearch-migration-guide-4.4-4.5.deprecations]]
|
||||
@ -9,8 +9,8 @@ introduced features.
|
||||
|
||||
=== `org.springframework.data.elasticsearch.client.erhlc` package
|
||||
|
||||
See <<elasticsearch-migration-guide-4.4-5.0.breaking-changes-packages>>, all classes in this package have been
|
||||
deprecated, as the default client implementations to use are the ones based on the new Java Client from
|
||||
See <<elasticsearch-migration-guide-4.4-5.0.breaking-changes-packages>>, all classes in this package have been
|
||||
deprecated, as the default client implementations to use are the ones based on the new Java Client from
|
||||
Elasticsearch, see <<elasticsearch-migration-guide-4.4-5.0.new-clients>>
|
||||
|
||||
[[elasticsearch-migration-guide-4.4-5.0.breaking-changes]]
|
||||
@ -20,33 +20,33 @@ Elasticsearch, see <<elasticsearch-migration-guide-4.4-5.0.new-clients>>
|
||||
|
||||
==== suggest calls in operations interfaces have been removed
|
||||
|
||||
Both `SearchOperations` and `ReactiveSearchOperations` had deprecated calls that were using Elasticsearch classes as
|
||||
Both `SearchOperations` and `ReactiveSearchOperations` had deprecated calls that were using Elasticsearch classes as
|
||||
parameters. These now have been removed and so the dependency on Elasticsearch classes in these APIs has been cleaned.
|
||||
|
||||
[[elasticsearch-migration-guide-4.4-5.0.breaking-changes-packages]]
|
||||
=== Package changes
|
||||
|
||||
All the classes that are using or depend on the deprecated Elasticsearch `RestHighLevelClient` have been moved to the
|
||||
package `org.springframework.data.elasticsearch.client.erhlc`. By this change we now have a clear separation of code
|
||||
using the old deprecated Elasticsearch libraries, code using the new Elasticsearch client and code that is
|
||||
All the classes that are using or depend on the deprecated Elasticsearch `RestHighLevelClient` have been moved to the
|
||||
package `org.springframework.data.elasticsearch.client.erhlc`. By this change we now have a clear separation of code
|
||||
using the old deprecated Elasticsearch libraries, code using the new Elasticsearch client and code that is
|
||||
independent of the client implementation. Also the reactive implementation that was provided up to now has been moved
|
||||
here, as this implementation contains code that was copied and adapted from Elasticsearch libraries.
|
||||
|
||||
If you are using `ElasticsearchRestTemplate` directly and not the `ElasticsearchOperations` interface you'll need to
|
||||
If you are using `ElasticsearchRestTemplate` directly and not the `ElasticsearchOperations` interface you'll need to
|
||||
adjust your imports as well.
|
||||
|
||||
When working with the `NativeSearchQuery` class, you'll need to switch to the `NativeQuery` class, which can take a
|
||||
When working with the `NativeSearchQuery` class, you'll need to switch to the `NativeQuery` class, which can take a
|
||||
`Query` instance comign from the new Elasticsearch client libraries. You'll find plenty of examples in the test code.
|
||||
|
||||
[[elasticsearch-migration-guide-4.4-5.0.new-clients]]
|
||||
== New Elasticsearch client
|
||||
|
||||
Spring Data Elasticsearch now uses the new `ElasticsearchClient` and has
|
||||
Spring Data Elasticsearch now uses the new `ElasticsearchClient` and has
|
||||
deprecated the use of the previous `RestHighLevelClient`.
|
||||
|
||||
=== Imperative style configuration
|
||||
|
||||
To configure Spring Data Elasticsearch to use the new client, it is necessary to create a configuration bean that
|
||||
To configure Spring Data Elasticsearch to use the new client, it is necessary to create a configuration bean that
|
||||
derives from `org.springframework.data.elasticsearch.client.elc.ElasticsearchConfiguration`:
|
||||
|
||||
====
|
||||
@ -101,7 +101,7 @@ With this configuration, the following beans will be available in the Spring app
|
||||
[[elasticsearch-migration-guide-4.4-5.0.old-client]]
|
||||
=== Still want to use the old client?
|
||||
|
||||
The old deprecated `RestHighLevelClient` can still be used, but you will need to add the dependency explicitly to
|
||||
The old deprecated `RestHighLevelClient` can still be used, but you will need to add the dependency explicitly to
|
||||
your application as Spring Data Elasticsearch does not pull it in automatically anymore:
|
||||
|
||||
====
|
||||
@ -122,4 +122,4 @@ your application as Spring Data Elasticsearch does not pull it in automatically
|
||||
----
|
||||
====
|
||||
|
||||
Make sure to specify the version 7.17.5 explicitly, otherwise maven will resolve to 8.3.2, and this does not exist.
|
||||
Make sure to specify the version 7.17.5 explicitly, otherwise maven will resolve to 8.3.3, and this does not exist.
|
||||
|
@ -17,7 +17,13 @@ package org.springframework.data.elasticsearch.client.elc;
|
||||
|
||||
import co.elastic.clients.elasticsearch._types.aggregations.Aggregate;
|
||||
import co.elastic.clients.elasticsearch.core.SearchResponse;
|
||||
import co.elastic.clients.elasticsearch.core.search.*;
|
||||
import co.elastic.clients.elasticsearch.core.search.CompletionSuggest;
|
||||
import co.elastic.clients.elasticsearch.core.search.CompletionSuggestOption;
|
||||
import co.elastic.clients.elasticsearch.core.search.Hit;
|
||||
import co.elastic.clients.elasticsearch.core.search.HitsMetadata;
|
||||
import co.elastic.clients.elasticsearch.core.search.ResponseBody;
|
||||
import co.elastic.clients.elasticsearch.core.search.Suggestion;
|
||||
import co.elastic.clients.elasticsearch.core.search.TotalHits;
|
||||
import co.elastic.clients.json.JsonpMapper;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -173,12 +179,13 @@ class SearchDocumentResponseBuilder {
|
||||
|
||||
List<TermSuggestion.Entry> entries = new ArrayList<>();
|
||||
suggestionsES.forEach(suggestionES -> {
|
||||
TermSuggest termSuggest = suggestionES.term();
|
||||
|
||||
TermSuggestOption optionES = termSuggest.options();
|
||||
var termSuggest = suggestionES.term();
|
||||
var termSuggestOptions = termSuggest.options();
|
||||
List<TermSuggestion.Entry.Option> options = new ArrayList<>();
|
||||
options.add(new TermSuggestion.Entry.Option(optionES.text(), null, optionES.score(), null,
|
||||
Math.toIntExact(optionES.freq())));
|
||||
termSuggestOptions.forEach(optionES -> {
|
||||
options.add(new TermSuggestion.Entry.Option(optionES.text(), null, optionES.score(), null,
|
||||
Math.toIntExact(optionES.freq())));
|
||||
});
|
||||
entries.add(new TermSuggestion.Entry(termSuggest.text(), termSuggest.offset(), termSuggest.length(), options));
|
||||
});
|
||||
return new TermSuggestion(name, suggestionsES.size(), entries, null);
|
||||
@ -188,10 +195,12 @@ class SearchDocumentResponseBuilder {
|
||||
|
||||
List<PhraseSuggestion.Entry> entries = new ArrayList<>();
|
||||
suggestionsES.forEach(suggestionES -> {
|
||||
PhraseSuggest phraseSuggest = suggestionES.phrase();
|
||||
PhraseSuggestOption optionES = phraseSuggest.options();
|
||||
var phraseSuggest = suggestionES.phrase();
|
||||
var phraseSuggestOptions = phraseSuggest.options();
|
||||
List<PhraseSuggestion.Entry.Option> options = new ArrayList<>();
|
||||
options.add(new PhraseSuggestion.Entry.Option(optionES.text(), optionES.highlighted(), null, null));
|
||||
phraseSuggestOptions.forEach(optionES -> {
|
||||
options.add(new PhraseSuggestion.Entry.Option(optionES.text(), optionES.highlighted(), null, null));
|
||||
});
|
||||
entries.add(new PhraseSuggestion.Entry(phraseSuggest.text(), phraseSuggest.offset(), phraseSuggest.length(),
|
||||
options, null));
|
||||
});
|
||||
|
@ -15,7 +15,7 @@
|
||||
#
|
||||
#
|
||||
sde.testcontainers.image-name=docker.elastic.co/elasticsearch/elasticsearch
|
||||
sde.testcontainers.image-version=8.3.2
|
||||
sde.testcontainers.image-version=8.3.3
|
||||
#
|
||||
#
|
||||
# needed as we do a DELETE /* at the end of the tests, will be required from 8.0 on, produces a warning since 7.13
|
||||
|
Loading…
x
Reference in New Issue
Block a user