Class ElasticsearchClients
java.lang.Object
org.springframework.data.elasticsearch.client.elc.ElasticsearchClients
Utility class to create the different Elasticsearch clients
- Since:
- 4.4
- Author:
- Peter-Josef Meisch
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
ClientConfiguration.ClientConfigurationCallback
to configure the Elasticsearch RestClient's Http client with aHttpAsyncClientBuilder
static interface
ClientConfiguration.ClientConfigurationCallback
to configure the RestClient client with aRestClientBuilder
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncreateImperative
(co.elastic.clients.transport.ElasticsearchTransport transport) Creates a newElasticsearchClient
that uses the givenElasticsearchTransport
.static co.elastic.clients.elasticsearch.ElasticsearchClient
createImperative
(org.elasticsearch.client.RestClient restClient) Creates a new imperativeElasticsearchClient
static co.elastic.clients.elasticsearch.ElasticsearchClient
createImperative
(org.elasticsearch.client.RestClient restClient, co.elastic.clients.transport.TransportOptions transportOptions, co.elastic.clients.json.JsonpMapper jsonpMapper) Creates a new imperativeElasticsearchClient
static co.elastic.clients.elasticsearch.ElasticsearchClient
createImperative
(ClientConfiguration clientConfiguration) Creates a new imperativeElasticsearchClient
static co.elastic.clients.elasticsearch.ElasticsearchClient
createImperative
(ClientConfiguration clientConfiguration, co.elastic.clients.transport.TransportOptions transportOptions) Creates a new imperativeElasticsearchClient
static ReactiveElasticsearchClient
createReactive
(co.elastic.clients.transport.ElasticsearchTransport transport) Creates a newReactiveElasticsearchClient
that uses the givenElasticsearchTransport
.static ReactiveElasticsearchClient
createReactive
(org.elasticsearch.client.RestClient restClient) Creates a newReactiveElasticsearchClient
.static ReactiveElasticsearchClient
createReactive
(org.elasticsearch.client.RestClient restClient, co.elastic.clients.transport.TransportOptions transportOptions, co.elastic.clients.json.JsonpMapper jsonpMapper) Creates a newReactiveElasticsearchClient
.static ReactiveElasticsearchClient
createReactive
(ClientConfiguration clientConfiguration) Creates a newReactiveElasticsearchClient
static ReactiveElasticsearchClient
createReactive
(ClientConfiguration clientConfiguration, co.elastic.clients.transport.TransportOptions transportOptions) Creates a newReactiveElasticsearchClient
static ReactiveElasticsearchClient
createReactive
(ClientConfiguration clientConfiguration, co.elastic.clients.transport.TransportOptions transportOptions, co.elastic.clients.json.JsonpMapper jsonpMapper) Creates a newReactiveElasticsearchClient
static co.elastic.clients.transport.ElasticsearchTransport
getElasticsearchTransport
(org.elasticsearch.client.RestClient restClient, String clientType, co.elastic.clients.transport.TransportOptions transportOptions, co.elastic.clients.json.JsonpMapper jsonpMapper) Creates anElasticsearchTransport
that will use the given client that additionally is customized with a header to contain the clientTypestatic org.elasticsearch.client.RestClient
getRestClient
(ClientConfiguration clientConfiguration) Creates a low levelRestClient
for the given configuration.
-
Field Details
-
IMPERATIVE_CLIENT
- See Also:
-
REACTIVE_CLIENT
- See Also:
-
-
Constructor Details
-
ElasticsearchClients
public ElasticsearchClients()
-
-
Method Details
-
createReactive
Creates a newReactiveElasticsearchClient
- Parameters:
clientConfiguration
- configuration options, must not be null.- Returns:
- the
ReactiveElasticsearchClient
-
createReactive
public static ReactiveElasticsearchClient createReactive(ClientConfiguration clientConfiguration, @Nullable co.elastic.clients.transport.TransportOptions transportOptions) Creates a newReactiveElasticsearchClient
- Parameters:
clientConfiguration
- configuration options, must not be null.transportOptions
- options to be added to each request.- Returns:
- the
ReactiveElasticsearchClient
-
createReactive
public static ReactiveElasticsearchClient createReactive(ClientConfiguration clientConfiguration, @Nullable co.elastic.clients.transport.TransportOptions transportOptions, co.elastic.clients.json.JsonpMapper jsonpMapper) Creates a newReactiveElasticsearchClient
- Parameters:
clientConfiguration
- configuration options, must not be null.transportOptions
- options to be added to each request.jsonpMapper
- the JsonpMapper to use- Returns:
- the
ReactiveElasticsearchClient
-
createReactive
public static ReactiveElasticsearchClient createReactive(org.elasticsearch.client.RestClient restClient) Creates a newReactiveElasticsearchClient
.- Parameters:
restClient
- the underlyingRestClient
- Returns:
- the
ReactiveElasticsearchClient
-
createReactive
public static ReactiveElasticsearchClient createReactive(org.elasticsearch.client.RestClient restClient, @Nullable co.elastic.clients.transport.TransportOptions transportOptions, co.elastic.clients.json.JsonpMapper jsonpMapper) Creates a newReactiveElasticsearchClient
.- Parameters:
restClient
- the underlyingRestClient
transportOptions
- options to be added to each request.- Returns:
- the
ReactiveElasticsearchClient
-
createReactive
public static ReactiveElasticsearchClient createReactive(co.elastic.clients.transport.ElasticsearchTransport transport) Creates a newReactiveElasticsearchClient
that uses the givenElasticsearchTransport
.- Parameters:
transport
- the transport to use- Returns:
- the
ElasticsearchClient
-
createImperative
public static co.elastic.clients.elasticsearch.ElasticsearchClient createImperative(ClientConfiguration clientConfiguration) Creates a new imperativeElasticsearchClient
- Parameters:
clientConfiguration
- configuration options, must not be null.- Returns:
- the
ElasticsearchClient
-
createImperative
public static co.elastic.clients.elasticsearch.ElasticsearchClient createImperative(ClientConfiguration clientConfiguration, co.elastic.clients.transport.TransportOptions transportOptions) Creates a new imperativeElasticsearchClient
- Parameters:
clientConfiguration
- configuration options, must not be null.transportOptions
- options to be added to each request.- Returns:
- the
ElasticsearchClient
-
createImperative
public static co.elastic.clients.elasticsearch.ElasticsearchClient createImperative(org.elasticsearch.client.RestClient restClient) Creates a new imperativeElasticsearchClient
- Parameters:
restClient
- the RestClient to use- Returns:
- the
ElasticsearchClient
-
createImperative
public static co.elastic.clients.elasticsearch.ElasticsearchClient createImperative(org.elasticsearch.client.RestClient restClient, @Nullable co.elastic.clients.transport.TransportOptions transportOptions, co.elastic.clients.json.JsonpMapper jsonpMapper) Creates a new imperativeElasticsearchClient
- Parameters:
restClient
- the RestClient to usetransportOptions
- options to be added to each request.jsonpMapper
- the mapper for the transport to use- Returns:
- the
ElasticsearchClient
-
createImperative
public static AutoCloseableElasticsearchClient createImperative(co.elastic.clients.transport.ElasticsearchTransport transport) Creates a newElasticsearchClient
that uses the givenElasticsearchTransport
.- Parameters:
transport
- the transport to use- Returns:
- the
ElasticsearchClient
-
getRestClient
public static org.elasticsearch.client.RestClient getRestClient(ClientConfiguration clientConfiguration) Creates a low levelRestClient
for the given configuration.- Parameters:
clientConfiguration
- must not be null- Returns:
- the
RestClient
-
getElasticsearchTransport
public static co.elastic.clients.transport.ElasticsearchTransport getElasticsearchTransport(org.elasticsearch.client.RestClient restClient, String clientType, @Nullable co.elastic.clients.transport.TransportOptions transportOptions, co.elastic.clients.json.JsonpMapper jsonpMapper) Creates anElasticsearchTransport
that will use the given client that additionally is customized with a header to contain the clientType- Parameters:
restClient
- the client to useclientType
- the client type to pass in each request as headertransportOptions
- options for the transportjsonpMapper
- mapper for the transport- Returns:
- ElasticsearchTransport
-