Class ElasticsearchUtil.Client
- java.lang.Object
-
- lumis.portal.bigdata.elasticsearch.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$
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
ElasticsearchUtil.Client.IResponseSupplier<REQ,RESP>
Deprecated.Since 16.1.0 due to deprecation ofRestHighLevelClient
.
-
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 callElasticsearchClient.search(co.elastic.clients.elasticsearch.core.SearchRequest, Class)
on the default big data repository.static <REQ,RESP>
RESPexecuteSync(REQ request, java.util.function.Function<org.elasticsearch.client.RestHighLevelClient,ElasticsearchUtil.Client.IResponseSupplier<REQ,RESP>> supplierCreator)
Deprecated.Since 16.1.0 due to deprecation ofRestHighLevelClient
.static void
updateByQueryRetryingOnConflict(co.elastic.clients.elasticsearch.core.UpdateByQueryRequest request, int retries)
Executes aElasticsearchClient.updateByQuery(UpdateByQueryRequest)
, retrying the operation the specified number of times in case of conflict response (409).
-
-
-
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 ofRestHighLevelClient
.Executes the given request in Elasticsearch default repository.- Type Parameters:
REQ
- request typeRESP
- response type- Parameters:
request
- the requestsupplierCreator
- 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 callElasticsearchClient.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 aElasticsearchClient.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 toConflicts.Proceed
andrefresh
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
-
-