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
Copy file name to clipboardExpand all lines: src/main/asciidoc/reference/elasticsearch-clients.adoc
+25-17
Original file line number
Diff line number
Diff line change
@@ -3,13 +3,14 @@
3
3
4
4
This chapter illustrates configuration and usage of supported Elasticsearch client implementations.
5
5
6
-
Spring Data Elasticsearch operates upon an Elasticsearch client that is connected to a single Elasticsearch node or a cluster. Although the Elasticsearch Client can be used to work with the cluster, applications using Spring Data Elasticsearch normally use the higher level abstractions of <<elasticsearch.operations>> and <<elasticsearch.repositories>>.
6
+
Spring Data Elasticsearch operates upon an Elasticsearch client that is connected to a single Elasticsearch node or a cluster.
7
+
Although the Elasticsearch Client can be used to work with the cluster, applications using Spring Data Elasticsearch normally use the higher level abstractions of <<elasticsearch.operations>> and <<elasticsearch.repositories>>.
7
8
8
9
[[elasticsearch.clients.transport]]
9
10
== Transport Client
10
11
11
-
WARNING: The `TransportClient` is deprecated as of Elasticsearch 7 and will be removed in Elasticsearch 8. (https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/transport-client.html[see the Elasticsearch documentation]). Spring Data Elasticsearch will support the `TransportClient` as long as it is available in the used
12
-
Elasticsearch <<elasticsearch.versions,version>> but has deprecated the classes using it since version 4.0.
12
+
WARNING: The `TransportClient` is deprecated as of Elasticsearch 7 and will be removed in Elasticsearch 8. (https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/transport-client.html[see the Elasticsearch documentation]).
13
+
Spring Data Elasticsearch will support the `TransportClient` as long as it is available in the used Elasticsearch <<elasticsearch.versions,version>> but has deprecated the classes using it since version 4.0.
13
14
14
15
We strongly recommend to use the <<elasticsearch.clients.rest>> instead of the `TransportClient`.
15
16
@@ -46,6 +47,7 @@ IndexRequest request = new IndexRequest("spring-data")
46
47
47
48
IndexResponse response = client.index(request);
48
49
----
50
+
49
51
<.> The `TransportClient` must be configured with the cluster name.
50
52
<.> The host and port to connect the client to.
51
53
<.> the RefreshPolicy must be set in the `ElasticsearchTemplate` (override `refreshPolicy()` to not use the default)
The Java High Level REST Client is the default client of Elasticsearch, it provides a straight forward replacement for the `TransportClient` as it accepts and returns
58
-
the very same request/response objects and therefore depends on the Elasticsearch core project.
59
+
The Java High Level REST Client is the default client of Elasticsearch, it provides a straight forward replacement for the `TransportClient` as it accepts and returns the very same request/response objects and therefore depends on the Elasticsearch core project.
59
60
Asynchronous calls are operated upon a client managed thread pool and require a callback to be notified when the request is done.
60
61
61
62
.High Level REST Client
@@ -93,6 +94,7 @@ IndexRequest request = new IndexRequest("spring-data")
<.> Define default headers, if they need to be customized
178
184
<.> Use the builder to provide cluster addresses, set default `HttpHeaders` or enable SSL.
179
185
<.> Optionally enable SSL.
180
186
<.> Optionally set a proxy.
181
187
<.> Optionally set a path prefix, mostly used when different clusters a behind some reverse proxy.
182
-
<.> Set the connection timeout. Default is 10 sec.
183
-
<.> Set the socket timeout. Default is 5 sec.
188
+
<.> Set the connection timeout.
189
+
Default is 10 sec.
190
+
<.> Set the socket timeout.
191
+
Default is 5 sec.
184
192
<.> Optionally set headers.
185
193
<.> Add basic authentication.
186
194
<.> A `Supplier<Header>` function can be specified which is called every time before a request is sent to Elasticsearch - here, as an example, the current time is written in a header.
187
195
<.> for reactive setup a function configuring the `WebClient`
188
196
<.> for non-reactive setup a function configuring the REST client
189
197
====
190
198
191
-
IMPORTANT: Adding a Header supplier as shown in above example allows to inject headers that may change over the time, like authentication JWT tokens. If this is used in the reactive setup, the supplier function *must not* block!
199
+
IMPORTANT: Adding a Header supplier as shown in above example allows to inject headers that may change over the time, like authentication JWT tokens.
200
+
If this is used in the reactive setup, the supplier function *must not* block!
192
201
193
202
[[elasticsearch.clients.logging]]
194
203
== Client Logging
195
204
196
-
To see what is actually sent to and received from the server `Request` / `Response` logging on the transport level needs
197
-
to be turned on as outlined in the snippet below.
205
+
To see what is actually sent to and received from the server `Request` / `Response` logging on the transport level needs to be turned on as outlined in the snippet below.
Copy file name to clipboardExpand all lines: src/main/asciidoc/reference/elasticsearch-migration-guide-4.2-4.3.adoc
+42-1
Original file line number
Diff line number
Diff line change
@@ -3,12 +3,53 @@
3
3
4
4
This section describes breaking changes from version 4.2.x to 4.3.x and how removed features can be replaced by new introduced features.
5
5
6
+
[NOTE]
7
+
====
8
+
Elasticsearch is working on a new Client that will replace the `RestHighLevelClient` because the `RestHighLevelClient` uses code from Elasticsearch core libraries which are not Apache 2 licensed anymore.
9
+
Spring Data Elasticsearch is preparing for this change as well.
10
+
This means that internally the implementations for the `*Operations` interfaces need to change - which should be no problem if users program against the interfaces like `ElasticsearchOperations` or `ReactiveElasticsearchOperations`.
11
+
If you are using the implementation classes like `ElasticsearchRestTemplate` directly, you will need to adapt to these changes.
12
+
13
+
Spring Data Elasticsearch also removes or replaces the use of classes from the `org.elasticsearch` packages in it's API classes and methods, only using them in the implementation where the access to Elasticsearch is implemented.
14
+
For the user that means, that some enum classes that were used are replaced by enums that live in `org.springframework.data.elasticsearch` with the same values, these are internally mapped onto the Elasticsearch ones.
15
+
16
+
Places where classes are used that cannot easily be replaced, this usage is marked as deprecated, we are working on replacements.
17
+
18
+
Check the sections on <<elasticsearch-migration-guide-4.2-4.3.deprecations>> and <<elasticsearch-migration-guide-4.2-4.3.breaking-changes>> for further details.
=== Removal of `org.elasticsearch` classes from the API.
28
+
29
+
* In the `org.springframework.data.elasticsearch.annotations.CompletionContext` annotation the property `type()` has changed from `org.elasticsearch.search.suggest.completion.context.ContextMapping.Type` to `org.springframework.data.elasticsearch.annotations.CompletionContext.ContextMappingType`, the available enum values are the same.
30
+
* In the `org.springframework.data.elasticsearch.annotations.Document` annotation the `versionType()` property has changed to `org.springframework.data.elasticsearch.annotations.Document.VersionType`, the available enum values are the same.
31
+
* In the `org.springframework.data.elasticsearch.core.query.Query` interface the `searchType()` property has changed to `org.springframework.data.elasticsearch.core.query.Query.SearchType`, the available enum values are the same.
32
+
* In the `org.springframework.data.elasticsearch.core.query.Query` interface the return value of `timeout()` was changed to `java.time.Duration`.
33
+
12
34
=== Handling of field and sourceFilter properties of Query
13
35
14
-
Up to version 4.2 the `fields` property of a `Query` was interpreted and added to the include list of the `sourceFilter`. This was not correct, as these are different things for Elasticsearch. This has been corrected. As a consequence code might not work anymore that relies on using `fields` to specify which fields should be returned from the document's `_source' and should be changed to use the `sourceFilter`.
36
+
Up to version 4.2 the `fields` property of a `Query` was interpreted and added to the include list of the `sourceFilter`.
37
+
This was not correct, as these are different things for Elasticsearch.
38
+
This has been corrected.
39
+
As a consequence code might not work anymore that relies on using `fields` to specify which fields should be returned from the document's `_source' and should be changed to use the `sourceFilter`.
40
+
41
+
=== search_type default value
42
+
43
+
The default value for the `search_type` in Elasticsearch is `query_then_fetch`.
44
+
This now is also set as default value in the `Query` implementations, it was previously set to `dfs_query_then_fetch`.
45
+
46
+
=== BulkOptions changes
47
+
48
+
Some properties of the `org.springframework.data.elasticsearch.core.query.BulkOptions` class have changed their type:
49
+
50
+
* the type of the `timeout` property has been changed to `java.time.Duration`.
51
+
* the type of the`refreshPolicy` property has been changed to `org.springframework.data.elasticsearch.core.RefreshPolicy`.
52
+
53
+
=== IndicesOptions change
54
+
55
+
Spring Data Elasticsearch now uses `org.springframework.data.elasticsearch.core.query.IndicesOptions` instead of `org.elasticsearch.action.support.IndicesOptions`.
0 commit comments