public class ElasticsearchClientImpl extends Object implements ElasticsearchClient
| Modifier and Type | Field and Description |
|---|---|
protected static Map<String,String> |
DEFAULT_PARAMS |
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 com.fasterxml.jackson.databind.node.ObjectNode |
createAliasActionNode(String indexName,
String aliasName,
String action,
String 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) |
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,
String 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 ElasticsearchClientpublic void updateIndexMetaData(String index, com.fasterxml.jackson.databind.JsonNode metaData)
updateIndexMetaData in interface ElasticsearchClientpublic com.fasterxml.jackson.databind.JsonNode getVersionInformation()
getVersionInformation in interface ElasticsearchClientpublic void createCustomAlias(String alias, String indexMapping)
createCustomAlias in interface ElasticsearchClientpublic com.fasterxml.jackson.databind.JsonNode createIndex(String indexName, String alias, String indexMapping)
ElasticsearchClientcreateIndex in interface ElasticsearchClientindexName - 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)
ElasticsearchClientcreateAliasForIndex in interface ElasticsearchClientprotected com.fasterxml.jackson.databind.JsonNode getAliasesForIndex(String index)
public void swapAlias(String alias, String oldIndexName, String newIndexName)
ElasticsearchClientswapAlias in interface ElasticsearchClientpublic void synchronousUpsertDocumentRequest(String index, String id, com.fasterxml.jackson.databind.node.ObjectNode objectNode)
ElasticsearchClientsynchronousUpsertDocumentRequest in interface ElasticsearchClientpublic void synchronousIndexDocumentRequest(String index, String id, com.fasterxml.jackson.databind.node.ObjectNode objectNode, Long version)
ElasticsearchClientsynchronousIndexDocumentRequest in interface ElasticsearchClientpublic void synchronousUpdateDocumentRequest(String index, String id, com.fasterxml.jackson.databind.node.ObjectNode objectNode, com.fasterxml.jackson.databind.node.ObjectNode scriptNode)
synchronousUpdateDocumentRequest in interface ElasticsearchClientpublic void updateByQuery(String index, com.fasterxml.jackson.databind.node.ObjectNode requestNode)
updateByQuery in interface ElasticsearchClientpublic void deleteDocument(String alias, String id)
deleteDocument in interface ElasticsearchClientpublic void deleteByQuery(String index, com.fasterxml.jackson.databind.node.ObjectNode requestNode)
deleteByQuery in interface ElasticsearchClientpublic com.fasterxml.jackson.databind.JsonNode query(String index, com.fasterxml.jackson.databind.node.ObjectNode queryBody)
query in interface ElasticsearchClientpublic com.fasterxml.jackson.databind.JsonNode getById(String index, String id)
getById in interface ElasticsearchClientpublic com.fasterxml.jackson.databind.JsonNode query(String index, String queryBody)
query in interface ElasticsearchClientprotected com.fasterxml.jackson.databind.JsonNode getJsonNode(String queryEndpoint, org.apache.http.HttpEntity entity)
public void deleteIndexIfExists(String index)
deleteIndexIfExists in interface ElasticsearchClientpublic void deleteAllIndicesWithPrefix(String prefix)
deleteAllIndicesWithPrefix in interface ElasticsearchClientpublic boolean indexExists(String index)
indexExists in interface ElasticsearchClientprotected com.fasterxml.jackson.databind.node.ObjectNode createAliasActionNode(String indexName, String aliasName, String action, String filter) throws Exception
Exceptionpublic void updateAliasMapping(String indexName, String aliasName, String indexMapping)
updateAliasMapping in interface ElasticsearchClientpublic void updateIndexMapping(String indexName, com.fasterxml.jackson.databind.JsonNode mappingDelta)
updateIndexMapping in interface ElasticsearchClientpublic void deleteAliasAndRelatedIndices(String alias)
deleteAliasAndRelatedIndices in interface ElasticsearchClientprotected void refreshAll()
public void deleteAliasForIndex(String alias, String index)
deleteAliasForIndex in interface ElasticsearchClientpublic void refreshIndex(String index)
refreshIndex in interface ElasticsearchClientpublic String getIndexNameForAlias(String alias)
getIndexNameForAlias in interface ElasticsearchClientprotected void addIncludeTypeNameParameterIfNeeded(org.elasticsearch.client.Request request)
public org.elasticsearch.client.RestClient getRestLowLevelClient()
getRestLowLevelClient in interface ElasticsearchClientpublic org.elasticsearch.client.RestHighLevelClient getRestHighLevelClient()
getRestHighLevelClient in interface ElasticsearchClientpublic com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()
public void setObjectMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
Copyright © 2019. All rights reserved.