Class ElasticsearchUtil.Client

  • Enclosing class:
    ElasticsearchUtil

    public abstract static class ElasticsearchUtil.Client
    extends java.lang.Object
    Elasticsearch client-related operations.
    Since:
    14.0.0
    Version:
    $Revision$ $Date$
    • Constructor Summary

      Constructors 
      Constructor Description
      Client()  
    • Method Summary

      All Methods Static Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      static <TDocumentType>
      co.elastic.clients.elasticsearch.core.SearchResponse<TDocumentType>
      executeSync​(co.elastic.clients.elasticsearch.core.SearchRequest searchRequest, java.lang.Class<TDocumentType> documentType)
      Utility method to call ElasticsearchClient.search(co.elastic.clients.elasticsearch.core.SearchRequest, Class) on the default big data repository.
      static <REQ,​RESP>
      RESP
      executeSync​(REQ request, java.util.function.Function<org.elasticsearch.client.RestHighLevelClient,​ElasticsearchUtil.Client.IResponseSupplier<REQ,​RESP>> supplierCreator)
      Deprecated.
      Since 16.1.0 due to deprecation of RestHighLevelClient.
      static void updateByQueryRetryingOnConflict​(co.elastic.clients.elasticsearch.core.UpdateByQueryRequest request, int retries)
      Executes a ElasticsearchClient.updateByQuery(UpdateByQueryRequest), retrying the operation the specified number of times in case of conflict response (409).
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Client

        public Client()
    • Method Detail

      • executeSync

        @Deprecated
        public static <REQ,​RESP> RESP executeSync​(REQ request,
                                                        java.util.function.Function<org.elasticsearch.client.RestHighLevelClient,​ElasticsearchUtil.Client.IResponseSupplier<REQ,​RESP>> supplierCreator)
        Deprecated.
        Since 16.1.0 due to deprecation of RestHighLevelClient.
        Executes the given request in Elasticsearch default repository.
        Type Parameters:
        REQ - request type
        RESP - response type
        Parameters:
        request - the request
        supplierCreator - the supplier of a response creator
        Returns:
        the response.
        Since:
        14.0.0
      • executeSync

        public static <TDocumentType> co.elastic.clients.elasticsearch.core.SearchResponse<TDocumentType> executeSync​(co.elastic.clients.elasticsearch.core.SearchRequest searchRequest,
                                                                                                                      java.lang.Class<TDocumentType> documentType)
        Utility method to call ElasticsearchClient.search(co.elastic.clients.elasticsearch.core.SearchRequest, Class) on the default big data repository.
        Type Parameters:
        TDocumentType - the class to convert to the documents in the response.
        Parameters:
        searchRequest - the search request.
        documentType - the class to convert to the documents in the response.
        Returns:
        the search response.
        Since:
        16.1.0
      • updateByQueryRetryingOnConflict

        public static void updateByQueryRetryingOnConflict​(co.elastic.clients.elasticsearch.core.UpdateByQueryRequest request,
                                                           int retries)
                                                    throws java.io.IOException
        Executes a ElasticsearchClient.updateByQuery(UpdateByQueryRequest), retrying the operation the specified number of times in case of conflict response (409).

        A conflict response is assumed to happen if the call throws a ResponseException with status code 409 or if the response indicates it has conflicts.

        To reduce conflict probability, it is recommended to use a request with UpdateByQueryRequest.conflicts() set to Conflicts.Proceed and refresh enabled.

        Parameters:
        request - the updateByQuery request.
        retries - the maximum number of retries.
        Throws:
        java.io.IOException - the exception thrown by the last try of executing the updateByQuery, or if the maximum number of retries is reached and conflicts occurred, although the updateByQuery did not throw it on the last attempt.
        Since:
        16.1.0