Package com.flowable.indexing
Class ElasticsearchClientImpl
- java.lang.Object
-
- com.flowable.indexing.ElasticsearchClientImpl
-
- All Implemented Interfaces:
ElasticsearchClient
public class ElasticsearchClientImpl extends Object implements ElasticsearchClient
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classElasticsearchClientImpl.BulkRequestClientImpl-
Nested classes/interfaces inherited from interface com.flowable.indexing.ElasticsearchClient
ElasticsearchClient.BulkRequestClient
-
-
Field Summary
Fields Modifier and Type Field Description protected org.elasticsearch.client.RequestOptionsdefaultRequestOptionsprotected ElasticsearchCompatibilityelasticsearchCompatibilityprotected static StringINCLUDE_TYPE_NAME_PARAMETERprotected com.fasterxml.jackson.databind.ObjectMapperobjectMapperprotected org.elasticsearch.client.RestClientrestClient
-
Constructor Summary
Constructors Constructor Description ElasticsearchClientImpl(org.elasticsearch.client.RestClient restClient, com.fasterxml.jackson.databind.ObjectMapper objectMapper, ElasticsearchCompatibility elasticsearchCompatibility, org.elasticsearch.client.RequestOptions defaultRequestOptions)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddIncludeTypeNameParameterIfNeeded(org.elasticsearch.client.Request request)protected FlowableExceptionasFlowableException(org.elasticsearch.client.ResponseException responseException, String fallbackMessage)ElasticsearchClient.BulkRequestClientbulkRequest()protected com.fasterxml.jackson.databind.node.ObjectNodecreateAliasActionNode(String indexName, String aliasName, String action, com.fasterxml.jackson.databind.JsonNode filter)voidcreateAliasForIndex(String alias, String index)Creates a new alias for the given index.voidcreateCustomAlias(String alias, String indexMapping)com.fasterxml.jackson.databind.JsonNodecreateIndex(String indexName, String alias, String indexMapping)Creates an index with the given name and creates an alias with the same name at the same time.voiddeleteAliasAndRelatedIndices(String alias)voiddeleteAliasForIndex(String alias, String index)voiddeleteAllIndicesWithPrefix(String prefix)voiddeleteByQuery(String index, com.fasterxml.jackson.databind.node.ObjectNode requestNode)voiddeleteDocument(String alias, String id)voiddeleteIndexIfExists(String index)protected com.fasterxml.jackson.databind.JsonNodegetAliasesForIndex(String index)com.fasterxml.jackson.databind.JsonNodegetById(String index, String id)com.fasterxml.jackson.databind.JsonNodegetIndexCurrentMapping(String index)com.fasterxml.jackson.databind.JsonNodegetIndexCurrentSettings(String index)StringgetIndexNameForAlias(String alias)protected com.fasterxml.jackson.databind.JsonNodegetJsonNode(String queryEndpoint, org.apache.http.HttpEntity entity)com.fasterxml.jackson.databind.ObjectMappergetObjectMapper()com.fasterxml.jackson.databind.JsonNodegetVersionInformation()booleanindexExists(String index)protected org.elasticsearch.client.ResponseperformRequest(org.elasticsearch.client.Request request)com.fasterxml.jackson.databind.JsonNodequery(String index, com.fasterxml.jackson.databind.node.ObjectNode queryBody)com.fasterxml.jackson.databind.JsonNodequery(String index, String queryBody)protected voidrefreshAll()voidrefreshIndex(String index)protected StringresponseMessage(org.elasticsearch.client.Response response, String fallbackMessage)voidsetObjectMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper)voidswapAlias(String alias, String oldIndexName, String newIndexName)Swaps the alias from one index to another index.voidsynchronousIndexDocumentRequest(String index, String id, com.fasterxml.jackson.databind.node.ObjectNode objectNode, Long version)Indexes a document using external versioning through Elasticsearch Index API, overriding the whole document.voidsynchronousUpdateDocumentRequest(String index, String id, com.fasterxml.jackson.databind.node.ObjectNode objectNode, com.fasterxml.jackson.databind.node.ObjectNode scriptNode)voidsynchronousUpsertDocumentRequest(String index, String id, com.fasterxml.jackson.databind.node.ObjectNode objectNode)Indexes a document using an upsert queryvoidupdateAliasMapping(String indexName, String aliasName, com.fasterxml.jackson.databind.JsonNode indexMapping)voidupdateByQuery(String index, com.fasterxml.jackson.databind.node.ObjectNode requestNode)voidupdateIndexMapping(String indexName, com.fasterxml.jackson.databind.JsonNode mappingDelta)voidupdateIndexMetaData(String index, com.fasterxml.jackson.databind.JsonNode metaData)
-
-
-
Field Detail
-
INCLUDE_TYPE_NAME_PARAMETER
protected static final String INCLUDE_TYPE_NAME_PARAMETER
- See Also:
- Constant Field Values
-
restClient
protected org.elasticsearch.client.RestClient restClient
-
objectMapper
protected com.fasterxml.jackson.databind.ObjectMapper objectMapper
-
elasticsearchCompatibility
protected ElasticsearchCompatibility elasticsearchCompatibility
-
defaultRequestOptions
protected org.elasticsearch.client.RequestOptions defaultRequestOptions
-
-
Constructor Detail
-
ElasticsearchClientImpl
public ElasticsearchClientImpl(org.elasticsearch.client.RestClient restClient, com.fasterxml.jackson.databind.ObjectMapper objectMapper, ElasticsearchCompatibility elasticsearchCompatibility, org.elasticsearch.client.RequestOptions defaultRequestOptions)
-
-
Method Detail
-
getIndexCurrentMapping
public com.fasterxml.jackson.databind.JsonNode getIndexCurrentMapping(String index)
- Specified by:
getIndexCurrentMappingin interfaceElasticsearchClient
-
getIndexCurrentSettings
public com.fasterxml.jackson.databind.JsonNode getIndexCurrentSettings(String index)
- Specified by:
getIndexCurrentSettingsin interfaceElasticsearchClient
-
updateIndexMetaData
public void updateIndexMetaData(String index, com.fasterxml.jackson.databind.JsonNode metaData)
- Specified by:
updateIndexMetaDatain interfaceElasticsearchClient
-
getVersionInformation
public com.fasterxml.jackson.databind.JsonNode getVersionInformation()
- Specified by:
getVersionInformationin interfaceElasticsearchClient
-
createCustomAlias
public void createCustomAlias(String alias, String indexMapping)
- Specified by:
createCustomAliasin interfaceElasticsearchClient
-
createIndex
public com.fasterxml.jackson.databind.JsonNode createIndex(String indexName, String alias, String indexMapping)
Description copied from interface:ElasticsearchClientCreates an index with the given name and creates an alias with the same name at the same time.- Specified by:
createIndexin interfaceElasticsearchClient- Parameters:
indexName- The name of the index.alias- The alias name for the index. If alias is null, NO alias will be created, but the index still will be created.indexMapping- The full ES mapping json that will be created.
-
createAliasForIndex
public void createAliasForIndex(String alias, String index)
Description copied from interface:ElasticsearchClientCreates a new alias for the given index.- Specified by:
createAliasForIndexin interfaceElasticsearchClient
-
getAliasesForIndex
protected com.fasterxml.jackson.databind.JsonNode getAliasesForIndex(String index)
-
swapAlias
public void swapAlias(String alias, String oldIndexName, String newIndexName)
Description copied from interface:ElasticsearchClientSwaps the alias from one index to another index.- Specified by:
swapAliasin interfaceElasticsearchClient
-
synchronousUpsertDocumentRequest
public void synchronousUpsertDocumentRequest(String index, String id, com.fasterxml.jackson.databind.node.ObjectNode objectNode)
Description copied from interface:ElasticsearchClientIndexes a document using an upsert query- Specified by:
synchronousUpsertDocumentRequestin interfaceElasticsearchClient
-
synchronousIndexDocumentRequest
public void synchronousIndexDocumentRequest(String index, String id, com.fasterxml.jackson.databind.node.ObjectNode objectNode, Long version)
Description copied from interface:ElasticsearchClientIndexes a document using external versioning through Elasticsearch Index API, overriding the whole document. Update API is not available for external versioning.- Specified by:
synchronousIndexDocumentRequestin interfaceElasticsearchClient
-
synchronousUpdateDocumentRequest
public void synchronousUpdateDocumentRequest(String index, String id, com.fasterxml.jackson.databind.node.ObjectNode objectNode, com.fasterxml.jackson.databind.node.ObjectNode scriptNode)
- Specified by:
synchronousUpdateDocumentRequestin interfaceElasticsearchClient
-
updateByQuery
public void updateByQuery(String index, com.fasterxml.jackson.databind.node.ObjectNode requestNode)
- Specified by:
updateByQueryin interfaceElasticsearchClient
-
deleteDocument
public void deleteDocument(String alias, String id)
- Specified by:
deleteDocumentin interfaceElasticsearchClient
-
deleteByQuery
public void deleteByQuery(String index, com.fasterxml.jackson.databind.node.ObjectNode requestNode)
- Specified by:
deleteByQueryin interfaceElasticsearchClient
-
query
public com.fasterxml.jackson.databind.JsonNode query(String index, com.fasterxml.jackson.databind.node.ObjectNode queryBody)
- Specified by:
queryin interfaceElasticsearchClient
-
getById
public com.fasterxml.jackson.databind.JsonNode getById(String index, String id)
- Specified by:
getByIdin interfaceElasticsearchClient
-
query
public com.fasterxml.jackson.databind.JsonNode query(String index, String queryBody)
- Specified by:
queryin interfaceElasticsearchClient
-
getJsonNode
protected com.fasterxml.jackson.databind.JsonNode getJsonNode(String queryEndpoint, org.apache.http.HttpEntity entity)
-
deleteIndexIfExists
public void deleteIndexIfExists(String index)
- Specified by:
deleteIndexIfExistsin interfaceElasticsearchClient
-
deleteAllIndicesWithPrefix
public void deleteAllIndicesWithPrefix(String prefix)
- Specified by:
deleteAllIndicesWithPrefixin interfaceElasticsearchClient
-
indexExists
public boolean indexExists(String index)
- Specified by:
indexExistsin interfaceElasticsearchClient
-
createAliasActionNode
protected com.fasterxml.jackson.databind.node.ObjectNode createAliasActionNode(String indexName, String aliasName, String action, com.fasterxml.jackson.databind.JsonNode filter)
-
updateAliasMapping
public void updateAliasMapping(String indexName, String aliasName, com.fasterxml.jackson.databind.JsonNode indexMapping)
- Specified by:
updateAliasMappingin interfaceElasticsearchClient
-
updateIndexMapping
public void updateIndexMapping(String indexName, com.fasterxml.jackson.databind.JsonNode mappingDelta)
- Specified by:
updateIndexMappingin interfaceElasticsearchClient
-
deleteAliasAndRelatedIndices
public void deleteAliasAndRelatedIndices(String alias)
- Specified by:
deleteAliasAndRelatedIndicesin interfaceElasticsearchClient
-
refreshAll
protected void refreshAll()
-
deleteAliasForIndex
public void deleteAliasForIndex(String alias, String index)
- Specified by:
deleteAliasForIndexin interfaceElasticsearchClient
-
refreshIndex
public void refreshIndex(String index)
- Specified by:
refreshIndexin interfaceElasticsearchClient
-
getIndexNameForAlias
public String getIndexNameForAlias(String alias)
- Specified by:
getIndexNameForAliasin interfaceElasticsearchClient
-
bulkRequest
public ElasticsearchClient.BulkRequestClient bulkRequest()
- Specified by:
bulkRequestin interfaceElasticsearchClient
-
performRequest
protected org.elasticsearch.client.Response performRequest(org.elasticsearch.client.Request request) throws IOException- Throws:
IOException
-
addIncludeTypeNameParameterIfNeeded
protected void addIncludeTypeNameParameterIfNeeded(org.elasticsearch.client.Request request)
-
getObjectMapper
public com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()
-
setObjectMapper
public void setObjectMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
-
asFlowableException
protected FlowableException asFlowableException(org.elasticsearch.client.ResponseException responseException, String fallbackMessage)
-
-