Class ElasticsearchClientImpl

java.lang.Object
com.flowable.indexing.ElasticsearchClientImpl
All Implemented Interfaces:
ElasticsearchClient

public class ElasticsearchClientImpl extends Object implements ElasticsearchClient
  • Field Details

    • INCLUDE_TYPE_NAME_PARAMETER

      protected static final String INCLUDE_TYPE_NAME_PARAMETER
      See Also:
    • 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 Details

    • ElasticsearchClientImpl

      public ElasticsearchClientImpl(org.elasticsearch.client.RestClient restClient, com.fasterxml.jackson.databind.ObjectMapper objectMapper, ElasticsearchCompatibility elasticsearchCompatibility, org.elasticsearch.client.RequestOptions defaultRequestOptions)
  • Method Details

    • getIndexCurrentMapping

      public com.fasterxml.jackson.databind.JsonNode getIndexCurrentMapping(String index)
      Specified by:
      getIndexCurrentMapping in interface ElasticsearchClient
    • getIndexCurrentSettings

      public com.fasterxml.jackson.databind.JsonNode getIndexCurrentSettings(String index)
      Specified by:
      getIndexCurrentSettings in interface ElasticsearchClient
    • setIndexSettings

      public com.fasterxml.jackson.databind.JsonNode setIndexSettings(String index, com.fasterxml.jackson.databind.node.ObjectNode settings)
      Specified by:
      setIndexSettings in interface ElasticsearchClient
    • updateIndexMetaData

      public void updateIndexMetaData(String index, com.fasterxml.jackson.databind.JsonNode metaData)
      Specified by:
      updateIndexMetaData in interface ElasticsearchClient
    • getVersionInformation

      public com.fasterxml.jackson.databind.JsonNode getVersionInformation()
      Specified by:
      getVersionInformation in interface ElasticsearchClient
    • createCustomAlias

      public void createCustomAlias(String alias, String indexMapping)
      Specified by:
      createCustomAlias in interface ElasticsearchClient
    • createIndex

      public com.fasterxml.jackson.databind.JsonNode createIndex(String indexName, String alias, String indexMapping)
      Description copied from interface: ElasticsearchClient
      Creates an index with the given name and creates an alias with the same name at the same time.
      Specified by:
      createIndex in interface ElasticsearchClient
      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: ElasticsearchClient
      Creates a new alias for the given index.
      Specified by:
      createAliasForIndex in interface ElasticsearchClient
    • getAliasesForIndex

      protected com.fasterxml.jackson.databind.JsonNode getAliasesForIndex(String index)
    • swapAlias

      public void swapAlias(String alias, String oldIndexName, String newIndexName)
      Description copied from interface: ElasticsearchClient
      Swaps the alias from one index to another index.
      Specified by:
      swapAlias in interface ElasticsearchClient
    • synchronousUpsertDocumentRequest

      public void synchronousUpsertDocumentRequest(String index, String id, com.fasterxml.jackson.databind.node.ObjectNode objectNode)
      Description copied from interface: ElasticsearchClient
      Indexes a document using an upsert query
      Specified by:
      synchronousUpsertDocumentRequest in interface ElasticsearchClient
    • synchronousIndexDocumentRequest

      public void synchronousIndexDocumentRequest(String index, String id, com.fasterxml.jackson.databind.node.ObjectNode objectNode, Long version)
      Description copied from interface: ElasticsearchClient
      Indexes a document using external versioning through Elasticsearch Index API, overriding the whole document. Update API is not available for external versioning.
      Specified by:
      synchronousIndexDocumentRequest in interface ElasticsearchClient
    • synchronousUpdateDocumentRequest

      public void synchronousUpdateDocumentRequest(String index, String id, com.fasterxml.jackson.databind.node.ObjectNode objectNode, com.fasterxml.jackson.databind.node.ObjectNode scriptNode)
      Specified by:
      synchronousUpdateDocumentRequest in interface ElasticsearchClient
    • updateByQuery

      public void updateByQuery(String index, com.fasterxml.jackson.databind.node.ObjectNode requestNode)
      Specified by:
      updateByQuery in interface ElasticsearchClient
    • deleteDocument

      public void deleteDocument(String alias, String id)
      Specified by:
      deleteDocument in interface ElasticsearchClient
    • deleteByQuery

      public void deleteByQuery(String index, com.fasterxml.jackson.databind.node.ObjectNode requestNode)
      Specified by:
      deleteByQuery in interface ElasticsearchClient
    • query

      public com.fasterxml.jackson.databind.JsonNode query(String index, com.fasterxml.jackson.databind.node.ObjectNode queryBody)
      Specified by:
      query in interface ElasticsearchClient
    • query

      public com.fasterxml.jackson.databind.JsonNode query(String index, com.fasterxml.jackson.databind.node.ObjectNode queryBody, boolean returnVersion)
    • getById

      public com.fasterxml.jackson.databind.JsonNode getById(String index, String id)
      Specified by:
      getById in interface ElasticsearchClient
    • query

      public com.fasterxml.jackson.databind.JsonNode query(String index, String queryBody)
      Specified by:
      query in interface ElasticsearchClient
    • query

      public com.fasterxml.jackson.databind.JsonNode query(String index, String queryBody, boolean returnVersion)
    • getJsonNode

      protected com.fasterxml.jackson.databind.JsonNode getJsonNode(String queryEndpoint, org.apache.http.HttpEntity entity)
    • deleteIndexIfExists

      public void deleteIndexIfExists(String index)
      Specified by:
      deleteIndexIfExists in interface ElasticsearchClient
    • indexExists

      public boolean indexExists(String index)
      Specified by:
      indexExists in interface ElasticsearchClient
    • 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:
      updateAliasMapping in interface ElasticsearchClient
    • updateIndexMapping

      public void updateIndexMapping(String indexName, com.fasterxml.jackson.databind.JsonNode mappingDelta)
      Specified by:
      updateIndexMapping in interface ElasticsearchClient
    • deleteAliasAndRelatedIndices

      public void deleteAliasAndRelatedIndices(String alias)
      Specified by:
      deleteAliasAndRelatedIndices in interface ElasticsearchClient
    • refreshAll

      protected void refreshAll()
    • deleteAliasForIndex

      public void deleteAliasForIndex(String alias, String index)
      Specified by:
      deleteAliasForIndex in interface ElasticsearchClient
    • refreshIndex

      public void refreshIndex(String index)
      Specified by:
      refreshIndex in interface ElasticsearchClient
    • getIndexNameForAlias

      public String getIndexNameForAlias(String alias)
      Specified by:
      getIndexNameForAlias in interface ElasticsearchClient
    • bulkRequest

      Specified by:
      bulkRequest in interface ElasticsearchClient
    • 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 org.flowable.common.engine.api.FlowableException asFlowableException(org.elasticsearch.client.ResponseException responseException, String fallbackMessage)
    • responseMessage

      protected String responseMessage(org.elasticsearch.client.Response response, String fallbackMessage)