Class ElasticsearchRestTemplate

java.lang.Object
org.springframework.data.elasticsearch.core.AbstractElasticsearchTemplate
org.springframework.data.elasticsearch.client.erhlc.ElasticsearchRestTemplate
All Implemented Interfaces:
Aware, ApplicationContextAware, DocumentOperations, ElasticsearchOperations, ScriptOperations, SearchOperations

@Deprecated public class ElasticsearchRestTemplate extends AbstractElasticsearchTemplate
Deprecated.
since 5.0
ElasticsearchRestTemplate
Since:
4.4
Author:
Rizwan Idrees, Mohsin Husen, Artur Konczak, Kevin Leturc, Mason Chan, Young Gu, Oliver Gierke, Mark Janssen, Chris White, Mark Paluch, Ilkang Na, Alen Turkovic, Sascha Woo, Ted Liang, Don Wellington, Zetang Zeng, Peter Nowak, Ivan Greene, Christoph Strobl, Lorenzo Spinelli, Dmitriy Yakovlev, Roman Puchkovskiy, Martin Choraine, Farid Azaza, Peter-Josef Meisch, Mathias Teier, Gyula Attila Csorogi, Massimiliano Poggi, Farid Faoudi, Sijia Liu, Hamid Rahimi
  • Field Details

    • requestFactory

      protected org.springframework.data.elasticsearch.client.erhlc.RequestFactory requestFactory
      Deprecated.
  • Constructor Details

    • ElasticsearchRestTemplate

      public ElasticsearchRestTemplate(org.elasticsearch.client.RestHighLevelClient client)
      Deprecated.
    • ElasticsearchRestTemplate

      public ElasticsearchRestTemplate(org.elasticsearch.client.RestHighLevelClient client, ElasticsearchConverter elasticsearchConverter)
      Deprecated.
  • Method Details

    • doCopy

      protected AbstractElasticsearchTemplate doCopy()
      Deprecated.
      Description copied from class: AbstractElasticsearchTemplate
      must return a copy of this instance that will for example be used to set a custom routing resolver without modifying the original object.
      Specified by:
      doCopy in class AbstractElasticsearchTemplate
    • getRequestFactory

      public org.springframework.data.elasticsearch.client.erhlc.RequestFactory getRequestFactory()
      Deprecated.
      Since:
      4.0
    • indexOps

      public IndexOperations indexOps(Class<?> clazz)
      Deprecated.
      Description copied from interface: ElasticsearchOperations
      get an IndexOperations that is bound to the given class
      Returns:
      IndexOperations
    • indexOps

      public IndexOperations indexOps(IndexCoordinates index)
      Deprecated.
      Description copied from interface: ElasticsearchOperations
      get an IndexOperations that is bound to the given index
      Returns:
      IndexOperations
    • cluster

      public ClusterOperations cluster()
      Deprecated.
      Description copied from interface: ElasticsearchOperations
      return a ClusterOperations instance that uses the same client communication setup as this ElasticsearchOperations instance.
      Returns:
      ClusterOperations implementation
    • doIndex

      public String doIndex(IndexQuery query, IndexCoordinates index)
      Deprecated.
      Specified by:
      doIndex in class AbstractElasticsearchTemplate
    • get

      @Nullable public <T> T get(String id, Class<T> clazz, IndexCoordinates index)
      Deprecated.
      Description copied from interface: DocumentOperations
      Retrieves an object from the index specified in the entity's Document annotation.
      Parameters:
      id - the id of the object
      clazz - the entity class,
      index - the index from which the object is read.
      Returns:
      the entity
    • multiGet

      public <T> List<MultiGetItem<T>> multiGet(Query query, Class<T> clazz, IndexCoordinates index)
      Deprecated.
      Description copied from interface: DocumentOperations
      Execute a multiGet against elasticsearch for the given ids.
      Parameters:
      query - the query defining the ids of the objects to get
      clazz - the type of the object to be returned
      index - the index(es) from which the objects are read.
      Returns:
      list of MultiGetItems
      See Also:
    • doExists

      protected boolean doExists(String id, IndexCoordinates index)
      Deprecated.
      Specified by:
      doExists in class AbstractElasticsearchTemplate
    • bulkUpdate

      public void bulkUpdate(List<UpdateQuery> queries, BulkOptions bulkOptions, IndexCoordinates index)
      Deprecated.
      Description copied from interface: DocumentOperations
      Bulk update all objects. Will do update.
      Parameters:
      queries - the queries to execute in bulk
      bulkOptions - options to be added to the bulk request
    • doDelete

      protected String doDelete(String id, @Nullable String routing, IndexCoordinates index)
      Deprecated.
      Specified by:
      doDelete in class AbstractElasticsearchTemplate
    • delete

      public ByQueryResponse delete(Query query, Class<?> clazz, IndexCoordinates index)
      Deprecated.
      Description copied from interface: DocumentOperations
      Delete all records matching the query.
      Parameters:
      query - query defining the objects
      clazz - The entity class, must be annotated with Document
      index - the index from which to delete
      Returns:
      response with detailed information
    • update

      public UpdateResponse update(UpdateQuery query, IndexCoordinates index)
      Deprecated.
      Description copied from interface: DocumentOperations
      Partial update of the document.
      Parameters:
      query - query defining the update
      index - the index where to update the records
      Returns:
      the update response
    • updateByQuery

      public ByQueryResponse updateByQuery(UpdateQuery query, IndexCoordinates index)
      Deprecated.
      Description copied from interface: DocumentOperations
      Update document(s) by query
      Parameters:
      query - query defining the update, must not be null
      index - the index where to update the records , must not be null
      Returns:
      the update response
    • reindex

      public ReindexResponse reindex(ReindexRequest reindexRequest)
      Deprecated.
      Description copied from interface: DocumentOperations
      Copies documents from a source to a destination. The source can be any existing index, alias, or data stream. The destination must differ from the source. For example, you cannot reindex a data stream into itself. (@see https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html)
      Parameters:
      reindexRequest - reindex request parameters
      Returns:
      the reindex response
    • submitReindex

      public String submitReindex(ReindexRequest reindexRequest)
      Deprecated.
      Description copied from interface: DocumentOperations
      Submits a reindex task. (@see https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html)
      Parameters:
      reindexRequest - reindex request parameters
      Returns:
      the task id
    • doBulkOperation

      public List<IndexedObjectInformation> doBulkOperation(List<?> queries, BulkOptions bulkOptions, IndexCoordinates index)
      Deprecated.
      Specified by:
      doBulkOperation in class AbstractElasticsearchTemplate
    • prepareWriteRequest

      protected <R extends org.elasticsearch.action.support.WriteRequest<R>> R prepareWriteRequest(R request)
      Deprecated.
      Preprocess the write request before it is sent to the server, e.g. by setting the refresh policy if applicable.
      Type Parameters:
      R - the request type
      Parameters:
      request - must not be null.
      Returns:
      the processed WriteRequest.
    • checkForBulkOperationFailure

      protected List<IndexedObjectInformation> checkForBulkOperationFailure(org.elasticsearch.action.bulk.BulkResponse bulkResponse)
      Deprecated.
      extract the list of IndexedObjectInformation from a BulkResponse.
      Parameters:
      bulkResponse - the response to evaluate
      Returns:
      the list of the IndexedObjectInformations
    • count

      public long count(Query query, @Nullable Class<?> clazz, IndexCoordinates index)
      Deprecated.
      Description copied from interface: SearchOperations
      return number of elements found by given query
      Parameters:
      query - the query to execute
      clazz - the entity clazz used for property mapping
      index - the index to run the query against
      Returns:
      count
    • search

      public <T> SearchHits<T> search(Query query, Class<T> clazz, IndexCoordinates index)
      Deprecated.
      Description copied from interface: SearchOperations
      Execute the criteria query against elasticsearch and return result as SearchHits
      Type Parameters:
      T - element return type
      Parameters:
      query - the query to execute
      clazz - the entity clazz used for property mapping
      index - the index to run the query against
      Returns:
      SearchHits containing the list of found objects
    • doSearch

      protected <T> SearchHits<T> doSearch(MoreLikeThisQuery query, Class<T> clazz, IndexCoordinates index)
      Deprecated.
      Specified by:
      doSearch in class AbstractElasticsearchTemplate
    • searchScrollStart

      public <T> SearchScrollHits<T> searchScrollStart(long scrollTimeInMillis, Query query, Class<T> clazz, IndexCoordinates index)
      Deprecated.
      Specified by:
      searchScrollStart in class AbstractElasticsearchTemplate
    • searchScrollContinue

      public <T> SearchScrollHits<T> searchScrollContinue(String scrollId, long scrollTimeInMillis, Class<T> clazz, IndexCoordinates index)
      Deprecated.
      Specified by:
      searchScrollContinue in class AbstractElasticsearchTemplate
    • searchScrollClear

      public void searchScrollClear(List<String> scrollIds)
      Deprecated.
      Specified by:
      searchScrollClear in class AbstractElasticsearchTemplate
    • suggest

      public org.elasticsearch.action.search.SearchResponse suggest(org.elasticsearch.search.suggest.SuggestBuilder suggestion, IndexCoordinates index)
      Deprecated.
    • multiSearch

      public <T> List<SearchHits<T>> multiSearch(List<? extends Query> queries, Class<T> clazz, IndexCoordinates index)
      Deprecated.
      Description copied from interface: SearchOperations
      Execute the multi search query against elasticsearch and return result as List of SearchHits.
      Type Parameters:
      T - element return type
      Parameters:
      queries - the queries to execute
      clazz - the entity clazz used for property mapping
      index - the index to run the query against
      Returns:
      list of SearchHits
    • multiSearch

      public List<SearchHits<?>> multiSearch(List<? extends Query> queries, List<Class<?>> classes)
      Deprecated.
      Description copied from interface: SearchOperations
      Execute the multi search query against elasticsearch and return result as List of SearchHits.
      Parameters:
      queries - the queries to execute
      classes - the entity classes
      Returns:
      list of SearchHits
    • multiSearch

      public List<SearchHits<?>> multiSearch(List<? extends Query> queries, List<Class<?>> classes, IndexCoordinates index)
      Deprecated.
      Description copied from interface: SearchOperations
      Execute the multi search query against elasticsearch and return result as List of SearchHits.
      Parameters:
      queries - the queries to execute
      classes - the entity classes used for property mapping
      index - the index to run the queries against
      Returns:
      list of SearchHits
    • multiSearch

      public List<SearchHits<?>> multiSearch(List<? extends Query> queries, List<Class<?>> classes, List<IndexCoordinates> indexes)
      Deprecated.
      Description copied from interface: SearchOperations
      Execute the multi search query against elasticsearch and return result as List of SearchHits.
      Parameters:
      queries - the queries to execute
      classes - the entity classes used for property mapping
      indexes - the indexes to run the queries against
      Returns:
      list of SearchHits
    • getMultiSearchResult

      protected org.elasticsearch.action.search.MultiSearchResponse.Item[] getMultiSearchResult(org.elasticsearch.action.search.MultiSearchRequest request)
      Deprecated.
    • execute

      public <T> T execute(ElasticsearchRestTemplate.ClientCallback<T> callback)
      Deprecated.
      Execute a callback with the RestHighLevelClient
      Type Parameters:
      T - the type returned from the callback
      Parameters:
      callback - the callback to execute, must not be null
      Returns:
      the callback result
      Since:
      4.0
    • getClusterVersion

      public String getClusterVersion()
      Deprecated.
      Description copied from class: AbstractElasticsearchTemplate
      tries to extract the version of the Elasticsearch cluster
      Specified by:
      getClusterVersion in class AbstractElasticsearchTemplate
      Returns:
      the version as string if it can be retrieved
    • matchAllQuery

      public Query matchAllQuery()
      Deprecated.
      Description copied from interface: SearchOperations
      Creates a Query to get all documents. Must be implemented by the concrete implementations to provide an appropriate query using the respective client.
      Returns:
      a query to find all documents
    • idsQuery

      public Query idsQuery(List<String> ids)
      Deprecated.
      Description copied from interface: SearchOperations
      Creates a Query to find get all documents with given ids. Must be implemented by the concrete implementations to provide an appropriate query using the respective client.
      Parameters:
      ids - the list of ids must not be null
      Returns:
      query returning the documents with the given ids
    • getVendor

      public String getVendor()
      Deprecated.
      Specified by:
      getVendor in class AbstractElasticsearchTemplate
      Returns:
      the vendor name of the used cluster and client library
    • getRuntimeLibraryVersion

      public String getRuntimeLibraryVersion()
      Deprecated.
      Specified by:
      getRuntimeLibraryVersion in class AbstractElasticsearchTemplate
      Returns:
      the version of the used client runtime library.
    • suggest

      @Deprecated public org.elasticsearch.action.search.SearchResponse suggest(org.elasticsearch.search.suggest.SuggestBuilder suggestion, Class<?> clazz)
      Deprecated.