本文整理匯總了Java中org.springframework.data.elasticsearch.core.ElasticsearchTemplate.deleteIndex方法的典型用法代碼示例。如果您正苦於以下問題:Java ElasticsearchTemplate.deleteIndex方法的具體用法?Java ElasticsearchTemplate.deleteIndex怎麽用?Java ElasticsearchTemplate.deleteIndex使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.springframework.data.elasticsearch.core.ElasticsearchTemplate
的用法示例。
在下文中一共展示了ElasticsearchTemplate.deleteIndex方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: beforeClass
import org.springframework.data.elasticsearch.core.ElasticsearchTemplate; //導入方法依賴的package包/類
@BeforeClass
public static void beforeClass() throws Exception {
elasticsearchServer = new EmbeddedElasticsearchServer();
elasticsearchTemplate = new ElasticsearchTemplate(elasticsearchServer.getClient());
elasticsearchTemplate.deleteIndex(INDEX_NAME);
String mappings = StreamUtils.copyToString(
ODataIntegrationTest.class.getResourceAsStream("mappings.json"),
StandardCharsets.UTF_8);
createIndex(INDEX_NAME, mappings);
waitForGreenStatus(INDEX_NAME);
indexDocument("entityId1", "entity1-source.json");
indexDocument("entityId2", "entity2-source.json");
indexDocument("entityId3", "entity3-source.json");
refresh(INDEX_NAME);
}
示例2: cleanUpPersistentData
import org.springframework.data.elasticsearch.core.ElasticsearchTemplate; //導入方法依賴的package包/類
private void cleanUpPersistentData(ElasticsearchTemplate elasticsearchTemplate) {
LOG.debug("Cleaning up persistent data from Elasticsearch: deleting indices, creating new ones, put mappings, refresh indices");
elasticsearchTemplate.deleteIndex(PivioDocument.class);
elasticsearchTemplate.deleteIndex(Changeset.class);
elasticsearchTemplate.createIndex(PivioDocument.class);
elasticsearchTemplate.putMapping(PivioDocument.class);
elasticsearchTemplate.createIndex(Changeset.class);
elasticsearchTemplate.putMapping(Changeset.class);
refreshIndices();
}