Class ElasticsearchClients

java.lang.Object
org.springframework.data.elasticsearch.client.elc.ElasticsearchClients

public final class ElasticsearchClients extends Object
Utility class to create the different Elasticsearch clients. The RestClient class is the one used in Elasticsearch until version 9, it is still available, but it's use is deprecated. The Rest5Client class is the one that should be used from Elasticsearch 9 on.
Since:
4.4
Author:
Peter-Josef Meisch
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
    static final String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    createImperative(co.elastic.clients.transport.ElasticsearchTransport transport)
    Creates a new ElasticsearchClient that uses the given ElasticsearchTransport.
    static co.elastic.clients.elasticsearch.ElasticsearchClient
    createImperative(co.elastic.clients.transport.rest5_client.low_level.Rest5Client rest5Client)
    Creates a new imperative ElasticsearchClient
    static co.elastic.clients.elasticsearch.ElasticsearchClient
    createImperative(co.elastic.clients.transport.rest5_client.low_level.Rest5Client rest5Client, @Nullable co.elastic.clients.transport.TransportOptions transportOptions, co.elastic.clients.json.JsonpMapper jsonpMapper)
    Creates a new imperative ElasticsearchClient
    static co.elastic.clients.elasticsearch.ElasticsearchClient
    createImperative(org.elasticsearch.client.RestClient restClient)
    Deprecated, for removal: This API element is subject to removal in a future version.
    since 6.0, use the version with a Rest5Client.
    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)
    Deprecated, for removal: This API element is subject to removal in a future version.
    since 6.0, use the version with a Rest5Client.
    static co.elastic.clients.elasticsearch.ElasticsearchClient
    Creates a new imperative ElasticsearchClient.
    static co.elastic.clients.elasticsearch.ElasticsearchClient
    createImperative(ClientConfiguration clientConfiguration, co.elastic.clients.transport.TransportOptions transportOptions)
    Creates a new imperative ElasticsearchClient.
    createReactive(co.elastic.clients.transport.ElasticsearchTransport transport)
    Creates a new ReactiveElasticsearchClient that uses the given ElasticsearchTransport.
    createReactive(co.elastic.clients.transport.rest5_client.low_level.Rest5Client rest5Client)
    createReactive(co.elastic.clients.transport.rest5_client.low_level.Rest5Client rest5Client, @Nullable co.elastic.clients.transport.TransportOptions transportOptions, co.elastic.clients.json.JsonpMapper jsonpMapper)
    createReactive(org.elasticsearch.client.RestClient restClient)
    Deprecated, for removal: This API element is subject to removal in a future version.
    since 6.0, use the version with a Rest5Client.
    createReactive(org.elasticsearch.client.RestClient restClient, @Nullable co.elastic.clients.transport.TransportOptions transportOptions, co.elastic.clients.json.JsonpMapper jsonpMapper)
    Deprecated, for removal: This API element is subject to removal in a future version.
    since 6.0, use the version with a Rest5Client.
    createReactive(ClientConfiguration clientConfiguration)
    createReactive(ClientConfiguration clientConfiguration, @Nullable co.elastic.clients.transport.TransportOptions transportOptions)
    createReactive(ClientConfiguration clientConfiguration, @Nullable co.elastic.clients.transport.TransportOptions transportOptions, co.elastic.clients.json.JsonpMapper jsonpMapper)
    static co.elastic.clients.transport.ElasticsearchTransport
    getElasticsearchTransport(co.elastic.clients.transport.rest5_client.low_level.Rest5Client rest5Client, String clientType, @Nullable co.elastic.clients.transport.TransportOptions transportOptions, co.elastic.clients.json.JsonpMapper jsonpMapper)
    Creates an ElasticsearchTransport that will use the given client that additionally is customized with a header to contain the clientType
    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)
    Deprecated, for removal: This API element is subject to removal in a future version.
    since 6.0, use the version taking a Rest5Client

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • ElasticsearchClients

      public ElasticsearchClients()
  • Method Details

    • createReactive

      public static ReactiveElasticsearchClient createReactive(ClientConfiguration clientConfiguration)
      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)
      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)
      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

      @Deprecated(since="6.0", forRemoval=true) public static ReactiveElasticsearchClient createReactive(org.elasticsearch.client.RestClient restClient)
      Deprecated, for removal: This API element is subject to removal in a future version.
      since 6.0, use the version with a Rest5Client.
      Parameters:
      restClient - the underlying RestClient
      Returns:
      the ReactiveElasticsearchClient
    • createReactive

      public static ReactiveElasticsearchClient createReactive(co.elastic.clients.transport.rest5_client.low_level.Rest5Client rest5Client)
      Parameters:
      rest5Client - the underlying RestClient
      Returns:
      the ReactiveElasticsearchClient
    • createReactive

      @Deprecated(since="6.0", forRemoval=true) public static ReactiveElasticsearchClient createReactive(org.elasticsearch.client.RestClient restClient, @Nullable co.elastic.clients.transport.TransportOptions transportOptions, co.elastic.clients.json.JsonpMapper jsonpMapper)
      Deprecated, for removal: This API element is subject to removal in a future version.
      since 6.0, use the version with a Rest5Client.
      Parameters:
      restClient - the underlying RestClient
      transportOptions - options to be added to each request.
      Returns:
      the ReactiveElasticsearchClient
    • createReactive

      public static ReactiveElasticsearchClient createReactive(co.elastic.clients.transport.rest5_client.low_level.Rest5Client rest5Client, @Nullable co.elastic.clients.transport.TransportOptions transportOptions, co.elastic.clients.json.JsonpMapper jsonpMapper)
      Parameters:
      rest5Client - the underlying RestClient
      transportOptions - options to be added to each request.
      Returns:
      the ReactiveElasticsearchClient
    • createReactive

      public static ReactiveElasticsearchClient createReactive(co.elastic.clients.transport.ElasticsearchTransport transport)
      Creates a new ReactiveElasticsearchClient that uses the given ElasticsearchTransport.
      Parameters:
      transport - the transport to use
      Returns:
      the invalid input: ''
    • createImperative

      public static co.elastic.clients.elasticsearch.ElasticsearchClient createImperative(ClientConfiguration clientConfiguration)
      Creates a new imperative ElasticsearchClient. This uses a RestClient, if the old RestClient is needed, this must be created with the RestClients class and passed in as parameter.
      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 imperative ElasticsearchClient. This uses a RestClient, if the old RestClient is needed, this must be created with the RestClients class and passed in as parameter.
      Parameters:
      clientConfiguration - configuration options, must not be null.
      transportOptions - options to be added to each request.
      Returns:
      the ElasticsearchClient
    • createImperative

      @Deprecated(since="6.0", forRemoval=true) public static co.elastic.clients.elasticsearch.ElasticsearchClient createImperative(org.elasticsearch.client.RestClient restClient)
      Deprecated, for removal: This API element is subject to removal in a future version.
      since 6.0, use the version with a Rest5Client.
      Creates a new imperative ElasticsearchClient
      Parameters:
      restClient - the RestClient to use
      Returns:
      the ElasticsearchClient
    • createImperative

      public static co.elastic.clients.elasticsearch.ElasticsearchClient createImperative(co.elastic.clients.transport.rest5_client.low_level.Rest5Client rest5Client)
      Creates a new imperative ElasticsearchClient
      Parameters:
      rest5Client - the Rest5Client to use
      Returns:
      the ElasticsearchClient
    • createImperative

      @Deprecated(since="6.0", forRemoval=true) 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)
      Deprecated, for removal: This API element is subject to removal in a future version.
      since 6.0, use the version with a Rest5Client.
      Creates a new imperative ElasticsearchClient
      Parameters:
      restClient - the RestClient to use
      transportOptions - options to be added to each request.
      jsonpMapper - the mapper for the transport to use
      Returns:
      the ElasticsearchClient
    • createImperative

      public static co.elastic.clients.elasticsearch.ElasticsearchClient createImperative(co.elastic.clients.transport.rest5_client.low_level.Rest5Client rest5Client, @Nullable co.elastic.clients.transport.TransportOptions transportOptions, co.elastic.clients.json.JsonpMapper jsonpMapper)
      Creates a new imperative ElasticsearchClient
      Parameters:
      rest5Client - the Rest5Client to use
      transportOptions - options to be added to each request.
      jsonpMapper - the mapper for the transport to use
      Returns:
      the ElasticsearchClient
      Since:
      6.0
    • createImperative

      public static AutoCloseableElasticsearchClient createImperative(co.elastic.clients.transport.ElasticsearchTransport transport)
      Creates a new ElasticsearchClient that uses the given ElasticsearchTransport.
      Parameters:
      transport - the transport to use
      Returns:
      the invalid input: ''
    • getElasticsearchTransport

      @Deprecated(since="6.0", forRemoval=true) 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)
      Deprecated, for removal: This API element is subject to removal in a future version.
      since 6.0, use the version taking a Rest5Client
      Creates an ElasticsearchTransport that will use the given client that additionally is customized with a header to contain the clientType
      Parameters:
      restClient - the client to use
      clientType - the client type to pass in each request as header
      transportOptions - options for the transport
      jsonpMapper - mapper for the transport
      Returns:
      ElasticsearchTransport
    • getElasticsearchTransport

      public static co.elastic.clients.transport.ElasticsearchTransport getElasticsearchTransport(co.elastic.clients.transport.rest5_client.low_level.Rest5Client rest5Client, String clientType, @Nullable co.elastic.clients.transport.TransportOptions transportOptions, co.elastic.clients.json.JsonpMapper jsonpMapper)
      Creates an ElasticsearchTransport that will use the given client that additionally is customized with a header to contain the clientType
      Parameters:
      rest5Client - the client to use
      clientType - the client type to pass in each request as header
      transportOptions - options for the transport
      jsonpMapper - mapper for the transport
      Returns:
      ElasticsearchTransport