public class ElasticsearchAdminServiceImpl extends Object implements ElasticsearchAdminService
ElasticsearchAdminService| Modifier and Type | Field and Description |
|---|---|
protected org.springframework.core.io.Resource |
authoringIndexSettings
Index settings file for authoring indices
|
static String |
DEFAULT_INDEX_NAME_SUFFIX |
protected org.elasticsearch.client.RestHighLevelClient |
elasticsearchClient
The Elasticsearch client
|
protected String |
indexNameSuffix
The suffix to add to all index names during creation
|
protected org.springframework.core.io.Resource |
previewIndexSettings
Index settings file for preview indices
|
| Constructor and Description |
|---|
ElasticsearchAdminServiceImpl(org.springframework.core.io.Resource authoringIndexSettings,
org.springframework.core.io.Resource previewIndexSettings,
org.elasticsearch.client.RestHighLevelClient elasticsearchClient) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
createIndex(String indexName,
boolean isAuthoring)
Creates an index
|
void |
deleteIndex(String indexName)
Deletes an index
|
protected void |
doCreateIndex(org.elasticsearch.client.RestHighLevelClient client,
String indexName,
boolean isAuthoring)
Performs the index creation using the given Elasticsearch client
|
protected void |
doDeleteIndex(org.elasticsearch.client.RestHighLevelClient client,
String indexName)
Performs the index delete using the given Elasticsearch client
|
protected boolean |
exists(org.elasticsearch.client.RestHighLevelClient client,
String indexName)
Checks if a given index already exists in Elasticsearch
|
void |
setIndexNameSuffix(String indexNameSuffix) |
public static final String DEFAULT_INDEX_NAME_SUFFIX
protected String indexNameSuffix
protected org.springframework.core.io.Resource authoringIndexSettings
protected org.springframework.core.io.Resource previewIndexSettings
protected org.elasticsearch.client.RestHighLevelClient elasticsearchClient
public ElasticsearchAdminServiceImpl(org.springframework.core.io.Resource authoringIndexSettings,
org.springframework.core.io.Resource previewIndexSettings,
org.elasticsearch.client.RestHighLevelClient elasticsearchClient)
public void setIndexNameSuffix(String indexNameSuffix)
protected boolean exists(org.elasticsearch.client.RestHighLevelClient client,
String indexName)
client - the elasticsearch clientindexName - the index namepublic void createIndex(String indexName, boolean isAuthoring) throws ElasticsearchException
createIndex in interface ElasticsearchAdminServiceindexName - the name of the indexisAuthoring - indicates if the index if for authoringElasticsearchException - if there is any error during the operationprotected void doCreateIndex(org.elasticsearch.client.RestHighLevelClient client,
String indexName,
boolean isAuthoring)
public void deleteIndex(String indexName) throws ElasticsearchException
deleteIndex in interface ElasticsearchAdminServiceindexName - the name of the indexElasticsearchException - if there is any error during the operationprotected void doDeleteIndex(org.elasticsearch.client.RestHighLevelClient client,
String indexName)
public void close()
throws Exception
close in interface AutoCloseableExceptionCopyright © 2020 CrafterCMS. All rights reserved.