Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/antora/antora-playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ content:
- url: https://github.com/spring-projects/spring-data-commons
# Refname matching:
# https://docs.antora.org/antora/latest/playbook/content-refname-matching/
branches: [ main, 3.4.x, 3.3.x ]
branches: [ main ]
start_path: src/main/antora
asciidoc:
attributes:
Expand Down
2 changes: 1 addition & 1 deletion src/main/antora/modules/ROOT/pages/elasticsearch.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Spring Data support for Elasticsearch contains a wide range of features:

* Spring configuration support for various xref:elasticsearch/clients.adoc[Elasticsearch clients].
* The xref:elasticsearch/template.adoc[`ElasticsearchTemplate` and `ReactiveElasticsearchTemplate`] helper classes that provide object mapping between ES index operations and POJOs.
* The xref:elasticsearch/template.adoc[`ElasticsearchTemplate` and `ReactiveElasticsearchTemplate`] helper classes that provide object mapping between Elasticsearch index operations and POJOs.
* xref:elasticsearch/template.adoc#exception-translation[Exception translation] into Spring's portable {springDocsUrl}data-access.html#dao-exceptions[Data Access Exception Hierarchy].
* Feature rich xref:elasticsearch/object-mapping.adoc[object mapping] integrated with _Spring's_ {springDocsUrl}core.html#core-convert[Conversion Service].
* xref:elasticsearch/object-mapping.adoc#elasticsearch.mapping.meta-model.annotations[Annotation-based mapping] metadata that is extensible to support other metadata formats.
Expand Down
22 changes: 15 additions & 7 deletions src/main/antora/modules/ROOT/pages/elasticsearch/clients.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Although the Elasticsearch Client can be used directly to work with the cluster,
[[elasticsearch.clients.rest5client]]
== Imperative Rest5Client

To use the imperative (non-reactive) Rest5Client, a configuration bean must be configured like this:
To use the imperative (non-reactive) Rest5Client - the default client provided by the Elasticsearch Java client library from version 9 on -, a configuration bean must be configured like this:

====
[source,java]
Expand Down Expand Up @@ -39,7 +39,9 @@ The following beans can then be injected in other Spring components:
====
[source,java]
----
import org.springframework.beans.factory.annotation.Autowired;@Autowired
import org.springframework.beans.factory.annotation.Autowired;

@Autowired
ElasticsearchOperations operations; <.>

@Autowired
Expand Down Expand Up @@ -83,7 +85,7 @@ To use the imperative (non-reactive) RestClient - deprecated since version 6 - ,
----
====

The configuration bean must be configured like this:
The configuration bean must then be configured like this:

====
[source,java]
Expand Down Expand Up @@ -113,14 +115,16 @@ The following beans can then be injected in other Spring components:
====
[source,java]
----
import org.springframework.beans.factory.annotation.Autowired;@Autowired
import org.springframework.beans.factory.annotation.Autowired;

@Autowired
ElasticsearchOperations operations; <.>

@Autowired
ElasticsearchClient elasticsearchClient; <.>

@Autowired
RestClient restClient; <.>
RestClient restClient; <.>

@Autowired
JsonpMapper jsonpMapper; <.>
Expand Down Expand Up @@ -167,6 +171,8 @@ The following beans can then be injected in other Spring components:
====
[source,java]
----
import org.springframework.beans.factory.annotation.Autowired;

@Autowired
ReactiveElasticsearchOperations operations; <.>

Expand Down Expand Up @@ -226,6 +232,8 @@ The following beans can then be injected in other Spring components:
====
[source,java]
----
import org.springframework.beans.factory.annotation.Autowired;

@Autowired
ReactiveElasticsearchOperations operations; <.>

Expand Down Expand Up @@ -294,7 +302,7 @@ ClientConfiguration clientConfiguration = ClientConfiguration.builder()

<.> Define default headers, if they need to be customized
<.> Use the builder to provide cluster addresses, set default `HttpHeaders` or enable SSL.
<.> Optionally enable SSL.There exist overloads of this function that can take a `SSLContext` or as an alternative the fingerprint of the certificate as it is output by Elasticsearch 8 on startup.
<.> Optionally enable SSL.There exist overloads of this function that can take a `SSLContext` or as an alternative the fingerprint of the certificate as it is output by Elasticsearch on startup (since version 8).
<.> Optionally set a proxy.
<.> Optionally set a path prefix, mostly used when different clusters a behind some reverse proxy.
<.> Set the connection timeout.
Expand All @@ -320,7 +328,7 @@ The following callbacks are provided:
==== Configuration of the low level Elasticsearch `Rest5Client`:

This callback provides a `org.elasticsearch.client.RestClientBuilder` that can be used to configure the Elasticsearch
`RestClient`:
`Rest5Client`:
====
[source,java]
----
Expand Down
2 changes: 1 addition & 1 deletion src/main/antora/modules/ROOT/pages/elasticsearch/misc.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ When creating Elasticsearch indices with Spring Data Elasticsearch different ind
The following arguments are available:

* `useServerConfiguration` does not send any settings parameters, so the Elasticsearch server configuration determines them.
* `settingPath` refers to a JSON file defining the settings that must be resolvable in the classpath
* `settingPath` refers to a JSON file defining the settings that must be resolvable in the classpath, it is possible to use a SpEL expression here
* `shards` the number of shards to use, defaults to _1_
* `replicas` the number of replicas, defaults to _1_
* `refreshIntervall`, defaults to _"1s"_
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ The following table shows the Elasticsearch and Spring versions that are used by
[cols="^,^,^,^",options="header"]
|===
| Spring Data Release Train | Spring Data Elasticsearch | Elasticsearch | Spring Framework
| 2025.1 (in development) | 6.0.x | 9.2.0 | 7.0.x
| 2025.1 | 6.0.x | 9.2.0 | 7.0.x
| 2025.0 | 5.5.x | 8.18.1 | 6.2.x
| 2024.1 | 5.4.x | 8.15.5 | 6.1.x
| 2024.0 | 5.3.xfootnote:oom[Out of maintenance] | 8.13.4 | 6.1.x
| 2024.1 | 5.4.xfootnote:oom[Out of maintenance] | 8.15.5 | 6.1.x
| 2024.0 | 5.3.xfootnote:oom[] | 8.13.4 | 6.1.x
| 2023.1 (Vaughan) | 5.2.xfootnote:oom[] | 8.11.1 | 6.1.x
| 2023.0 (Ullmann) | 5.1.xfootnote:oom[] | 8.7.1 | 6.0.x
| 2022.0 (Turing) | 5.0.xfootnote:oom[] | 8.5.3 | 6.0.x
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,7 @@
import co.elastic.clients.transport.rest5_client.Rest5ClientOptions;
import co.elastic.clients.transport.rest5_client.low_level.RequestOptions;
import co.elastic.clients.transport.rest5_client.low_level.Rest5Client;
import co.elastic.clients.transport.rest_client.RestClientOptions;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import org.elasticsearch.client.RestClient;
import org.springframework.context.annotation.Bean;
import org.springframework.data.elasticsearch.client.ClientConfiguration;
Expand All @@ -36,6 +32,10 @@
import org.springframework.data.elasticsearch.core.convert.ElasticsearchConverter;
import org.springframework.util.Assert;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;

/**
* Base class for a @{@link org.springframework.context.annotation.Configuration} class to set up the Elasticsearch
* connection using the {@link ReactiveElasticsearchClient}. This class exposes different parts of the setup as Spring
Expand Down