DATAES-71 - Enhance Create Index in ElasticsearchTemplate
added createIndex(String indexName) method
This commit is contained in:
@@ -45,6 +45,14 @@ public interface ElasticsearchOperations {
|
||||
*/
|
||||
<T> boolean createIndex(Class<T> clazz);
|
||||
|
||||
/**
|
||||
* Create an index for given indexName
|
||||
*
|
||||
* @param indexName
|
||||
*/
|
||||
boolean createIndex(String indexName);
|
||||
|
||||
|
||||
/**
|
||||
* Create mapping for a class
|
||||
*
|
||||
|
||||
@@ -117,6 +117,14 @@ public class ElasticsearchTemplate implements ElasticsearchOperations {
|
||||
return createIndexIfNotCreated(clazz);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean createIndex(String indexName) {
|
||||
Assert.notNull(indexName, "No index defined for Query");
|
||||
return client.admin().indices()
|
||||
.create(Requests.createIndexRequest(indexName))
|
||||
.actionGet().isAcknowledged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> boolean putMapping(Class<T> clazz) {
|
||||
ElasticsearchPersistentEntity<T> persistentEntity = getPersistentEntityFor(clazz);
|
||||
|
||||
Reference in New Issue
Block a user