public class ElasticsearchClientImpl extends Object implements ElasticsearchClient
Modifier and Type | Field and Description |
---|---|
protected ElasticsearchCompatibility |
elasticsearchCompatibility |
protected static String |
INCLUDE_TYPE_NAME_PARAMETER |
protected com.fasterxml.jackson.databind.ObjectMapper |
objectMapper |
protected org.elasticsearch.client.RestHighLevelClient |
restClient |
Constructor and Description |
---|
ElasticsearchClientImpl(org.elasticsearch.client.RestHighLevelClient restClient,
com.fasterxml.jackson.databind.ObjectMapper objectMapper,
ElasticsearchCompatibility elasticsearchCompatibility) |
Modifier and Type | Method and Description |
---|---|
protected void |
addIncludeTypeNameParameterIfNeeded(org.elasticsearch.client.Request request) |
protected FlowableException |
asFlowableException(org.elasticsearch.client.ResponseException responseException,
String fallbackMessage) |
protected com.fasterxml.jackson.databind.node.ObjectNode |
createAliasActionNode(String indexName,
String aliasName,
String action,
com.fasterxml.jackson.databind.JsonNode filter) |
void |
createAliasForIndex(String alias,
String index)
Creates a new alias for the given index.
|
void |
createCustomAlias(String alias,
String indexMapping) |
com.fasterxml.jackson.databind.JsonNode |
createIndex(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.
|
void |
deleteAliasAndRelatedIndices(String alias) |
void |
deleteAliasForIndex(String alias,
String index) |
void |
deleteAllIndicesWithPrefix(String prefix) |
void |
deleteByQuery(String index,
com.fasterxml.jackson.databind.node.ObjectNode requestNode) |
void |
deleteDocument(String alias,
String id) |
void |
deleteIndexIfExists(String index) |
protected com.fasterxml.jackson.databind.JsonNode |
getAliasesForIndex(String index) |
com.fasterxml.jackson.databind.JsonNode |
getById(String index,
String id) |
com.fasterxml.jackson.databind.JsonNode |
getIndexCurrentMapping(String index) |
String |
getIndexNameForAlias(String alias) |
protected com.fasterxml.jackson.databind.JsonNode |
getJsonNode(String queryEndpoint,
org.apache.http.HttpEntity entity) |
com.fasterxml.jackson.databind.ObjectMapper |
getObjectMapper() |
org.elasticsearch.client.RestHighLevelClient |
getRestHighLevelClient() |
org.elasticsearch.client.RestClient |
getRestLowLevelClient() |
com.fasterxml.jackson.databind.JsonNode |
getVersionInformation() |
boolean |
indexExists(String index) |
com.fasterxml.jackson.databind.JsonNode |
query(String index,
com.fasterxml.jackson.databind.node.ObjectNode queryBody) |
com.fasterxml.jackson.databind.JsonNode |
query(String index,
String queryBody) |
protected void |
refreshAll() |
void |
refreshIndex(String index) |
protected String |
responseMessage(org.elasticsearch.client.Response response,
String fallbackMessage) |
void |
setObjectMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper) |
void |
swapAlias(String alias,
String oldIndexName,
String newIndexName)
Swaps the alias from one index to another index.
|
void |
synchronousIndexDocumentRequest(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.
|
void |
synchronousUpdateDocumentRequest(String index,
String id,
com.fasterxml.jackson.databind.node.ObjectNode objectNode,
com.fasterxml.jackson.databind.node.ObjectNode scriptNode) |
void |
synchronousUpsertDocumentRequest(String index,
String id,
com.fasterxml.jackson.databind.node.ObjectNode objectNode)
Indexes a document using an upsert query
|
void |
updateAliasMapping(String indexName,
String aliasName,
com.fasterxml.jackson.databind.JsonNode indexMapping) |
void |
updateByQuery(String index,
com.fasterxml.jackson.databind.node.ObjectNode requestNode) |
void |
updateIndexMapping(String indexName,
com.fasterxml.jackson.databind.JsonNode mappingDelta) |
void |
updateIndexMetaData(String index,
com.fasterxml.jackson.databind.JsonNode metaData) |
protected static final String INCLUDE_TYPE_NAME_PARAMETER
protected org.elasticsearch.client.RestHighLevelClient restClient
protected com.fasterxml.jackson.databind.ObjectMapper objectMapper
protected ElasticsearchCompatibility elasticsearchCompatibility
public ElasticsearchClientImpl(org.elasticsearch.client.RestHighLevelClient restClient, com.fasterxml.jackson.databind.ObjectMapper objectMapper, ElasticsearchCompatibility elasticsearchCompatibility)
public com.fasterxml.jackson.databind.JsonNode getIndexCurrentMapping(String index)
getIndexCurrentMapping
in interface ElasticsearchClient
public void updateIndexMetaData(String index, com.fasterxml.jackson.databind.JsonNode metaData)
updateIndexMetaData
in interface ElasticsearchClient
public com.fasterxml.jackson.databind.JsonNode getVersionInformation()
getVersionInformation
in interface ElasticsearchClient
public void createCustomAlias(String alias, String indexMapping)
createCustomAlias
in interface ElasticsearchClient
public com.fasterxml.jackson.databind.JsonNode createIndex(String indexName, String alias, String indexMapping)
ElasticsearchClient
createIndex
in interface ElasticsearchClient
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.public void createAliasForIndex(String alias, String index)
ElasticsearchClient
createAliasForIndex
in interface ElasticsearchClient
protected com.fasterxml.jackson.databind.JsonNode getAliasesForIndex(String index)
public void swapAlias(String alias, String oldIndexName, String newIndexName)
ElasticsearchClient
swapAlias
in interface ElasticsearchClient
public void synchronousUpsertDocumentRequest(String index, String id, com.fasterxml.jackson.databind.node.ObjectNode objectNode)
ElasticsearchClient
synchronousUpsertDocumentRequest
in interface ElasticsearchClient
public void synchronousIndexDocumentRequest(String index, String id, com.fasterxml.jackson.databind.node.ObjectNode objectNode, Long version)
ElasticsearchClient
synchronousIndexDocumentRequest
in interface ElasticsearchClient
public void synchronousUpdateDocumentRequest(String index, String id, com.fasterxml.jackson.databind.node.ObjectNode objectNode, com.fasterxml.jackson.databind.node.ObjectNode scriptNode)
synchronousUpdateDocumentRequest
in interface ElasticsearchClient
public void updateByQuery(String index, com.fasterxml.jackson.databind.node.ObjectNode requestNode)
updateByQuery
in interface ElasticsearchClient
public void deleteDocument(String alias, String id)
deleteDocument
in interface ElasticsearchClient
public void deleteByQuery(String index, com.fasterxml.jackson.databind.node.ObjectNode requestNode)
deleteByQuery
in interface ElasticsearchClient
public com.fasterxml.jackson.databind.JsonNode query(String index, com.fasterxml.jackson.databind.node.ObjectNode queryBody)
query
in interface ElasticsearchClient
public com.fasterxml.jackson.databind.JsonNode getById(String index, String id)
getById
in interface ElasticsearchClient
public com.fasterxml.jackson.databind.JsonNode query(String index, String queryBody)
query
in interface ElasticsearchClient
protected com.fasterxml.jackson.databind.JsonNode getJsonNode(String queryEndpoint, org.apache.http.HttpEntity entity)
public void deleteIndexIfExists(String index)
deleteIndexIfExists
in interface ElasticsearchClient
public void deleteAllIndicesWithPrefix(String prefix)
deleteAllIndicesWithPrefix
in interface ElasticsearchClient
public boolean indexExists(String index)
indexExists
in interface ElasticsearchClient
protected com.fasterxml.jackson.databind.node.ObjectNode createAliasActionNode(String indexName, String aliasName, String action, com.fasterxml.jackson.databind.JsonNode filter)
public void updateAliasMapping(String indexName, String aliasName, com.fasterxml.jackson.databind.JsonNode indexMapping)
updateAliasMapping
in interface ElasticsearchClient
public void updateIndexMapping(String indexName, com.fasterxml.jackson.databind.JsonNode mappingDelta)
updateIndexMapping
in interface ElasticsearchClient
public void deleteAliasAndRelatedIndices(String alias)
deleteAliasAndRelatedIndices
in interface ElasticsearchClient
protected void refreshAll()
public void deleteAliasForIndex(String alias, String index)
deleteAliasForIndex
in interface ElasticsearchClient
public void refreshIndex(String index)
refreshIndex
in interface ElasticsearchClient
public String getIndexNameForAlias(String alias)
getIndexNameForAlias
in interface ElasticsearchClient
protected void addIncludeTypeNameParameterIfNeeded(org.elasticsearch.client.Request request)
public org.elasticsearch.client.RestClient getRestLowLevelClient()
getRestLowLevelClient
in interface ElasticsearchClient
public org.elasticsearch.client.RestHighLevelClient getRestHighLevelClient()
getRestHighLevelClient
in interface ElasticsearchClient
public com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()
public void setObjectMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
protected FlowableException asFlowableException(org.elasticsearch.client.ResponseException responseException, String fallbackMessage)