本文整理汇总了Java中org.elasticsearch.action.admin.indices.close.CloseIndexResponse类的典型用法代码示例。如果您正苦于以下问题:Java CloseIndexResponse类的具体用法?Java CloseIndexResponse怎么用?Java CloseIndexResponse使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CloseIndexResponse类属于org.elasticsearch.action.admin.indices.close包,在下文中一共展示了CloseIndexResponse类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testCloseOpenMultipleIndices
import org.elasticsearch.action.admin.indices.close.CloseIndexResponse; //导入依赖的package包/类
public void testCloseOpenMultipleIndices() {
Client client = client();
createIndex("test1", "test2", "test3");
ClusterHealthResponse healthResponse = client.admin().cluster().prepareHealth().setWaitForGreenStatus().execute().actionGet();
assertThat(healthResponse.isTimedOut(), equalTo(false));
CloseIndexResponse closeIndexResponse1 = client.admin().indices().prepareClose("test1").execute().actionGet();
assertThat(closeIndexResponse1.isAcknowledged(), equalTo(true));
CloseIndexResponse closeIndexResponse2 = client.admin().indices().prepareClose("test2").execute().actionGet();
assertThat(closeIndexResponse2.isAcknowledged(), equalTo(true));
assertIndexIsClosed("test1", "test2");
assertIndexIsOpened("test3");
OpenIndexResponse openIndexResponse1 = client.admin().indices().prepareOpen("test1").execute().actionGet();
assertThat(openIndexResponse1.isAcknowledged(), equalTo(true));
OpenIndexResponse openIndexResponse2 = client.admin().indices().prepareOpen("test2").execute().actionGet();
assertThat(openIndexResponse2.isAcknowledged(), equalTo(true));
assertIndexIsOpened("test1", "test2", "test3");
}
示例2: testCloseAlreadyClosedIndex
import org.elasticsearch.action.admin.indices.close.CloseIndexResponse; //导入依赖的package包/类
public void testCloseAlreadyClosedIndex() {
Client client = client();
createIndex("test1");
ClusterHealthResponse healthResponse = client.admin().cluster().prepareHealth().setWaitForGreenStatus().execute().actionGet();
assertThat(healthResponse.isTimedOut(), equalTo(false));
//closing the index
CloseIndexResponse closeIndexResponse = client.admin().indices().prepareClose("test1").execute().actionGet();
assertThat(closeIndexResponse.isAcknowledged(), equalTo(true));
assertIndexIsClosed("test1");
//no problem if we try to close an index that's already in close state
closeIndexResponse = client.admin().indices().prepareClose("test1").execute().actionGet();
assertThat(closeIndexResponse.isAcknowledged(), equalTo(true));
assertIndexIsClosed("test1");
}
示例3: testSimpleCloseOpenAlias
import org.elasticsearch.action.admin.indices.close.CloseIndexResponse; //导入依赖的package包/类
public void testSimpleCloseOpenAlias() {
Client client = client();
createIndex("test1");
ClusterHealthResponse healthResponse = client.admin().cluster().prepareHealth().setWaitForGreenStatus().execute().actionGet();
assertThat(healthResponse.isTimedOut(), equalTo(false));
IndicesAliasesResponse aliasesResponse = client.admin().indices().prepareAliases().addAlias("test1", "test1-alias").execute().actionGet();
assertThat(aliasesResponse.isAcknowledged(), equalTo(true));
CloseIndexResponse closeIndexResponse = client.admin().indices().prepareClose("test1-alias").execute().actionGet();
assertThat(closeIndexResponse.isAcknowledged(), equalTo(true));
assertIndexIsClosed("test1");
OpenIndexResponse openIndexResponse = client.admin().indices().prepareOpen("test1-alias").execute().actionGet();
assertThat(openIndexResponse.isAcknowledged(), equalTo(true));
assertIndexIsOpened("test1");
}
示例4: testCloseOpenAliasMultipleIndices
import org.elasticsearch.action.admin.indices.close.CloseIndexResponse; //导入依赖的package包/类
public void testCloseOpenAliasMultipleIndices() {
Client client = client();
createIndex("test1", "test2");
ClusterHealthResponse healthResponse = client.admin().cluster().prepareHealth().setWaitForGreenStatus().execute().actionGet();
assertThat(healthResponse.isTimedOut(), equalTo(false));
IndicesAliasesResponse aliasesResponse1 = client.admin().indices().prepareAliases().addAlias("test1", "test-alias").execute().actionGet();
assertThat(aliasesResponse1.isAcknowledged(), equalTo(true));
IndicesAliasesResponse aliasesResponse2 = client.admin().indices().prepareAliases().addAlias("test2", "test-alias").execute().actionGet();
assertThat(aliasesResponse2.isAcknowledged(), equalTo(true));
CloseIndexResponse closeIndexResponse = client.admin().indices().prepareClose("test-alias").execute().actionGet();
assertThat(closeIndexResponse.isAcknowledged(), equalTo(true));
assertIndexIsClosed("test1", "test2");
OpenIndexResponse openIndexResponse = client.admin().indices().prepareOpen("test-alias").execute().actionGet();
assertThat(openIndexResponse.isAcknowledged(), equalTo(true));
assertIndexIsOpened("test1", "test2");
}
示例5: testSimpleCloseOpen
import org.elasticsearch.action.admin.indices.close.CloseIndexResponse; //导入依赖的package包/类
public void testSimpleCloseOpen() {
Client client = client();
createIndex("test1");
ClusterHealthResponse healthResponse = client.admin().cluster().prepareHealth().setWaitForGreenStatus().execute().actionGet();
assertThat(healthResponse.isTimedOut(), equalTo(false));
CloseIndexResponse closeIndexResponse = client.admin().indices().prepareClose("test1").execute().actionGet();
assertThat(closeIndexResponse.isAcknowledged(), equalTo(true));
assertIndexIsClosed("test1");
OpenIndexResponse openIndexResponse = client.admin().indices().prepareOpen("test1").execute().actionGet();
assertThat(openIndexResponse.isAcknowledged(), equalTo(true));
assertIndexIsOpened("test1");
}
示例6: testCloseOneMissingIndexIgnoreMissing
import org.elasticsearch.action.admin.indices.close.CloseIndexResponse; //导入依赖的package包/类
public void testCloseOneMissingIndexIgnoreMissing() {
Client client = client();
createIndex("test1");
ClusterHealthResponse healthResponse = client.admin().cluster().prepareHealth().setWaitForGreenStatus().execute().actionGet();
assertThat(healthResponse.isTimedOut(), equalTo(false));
CloseIndexResponse closeIndexResponse = client.admin().indices().prepareClose("test1", "test2")
.setIndicesOptions(IndicesOptions.lenientExpandOpen()).execute().actionGet();
assertThat(closeIndexResponse.isAcknowledged(), equalTo(true));
assertIndexIsClosed("test1");
}
示例7: testCloseOpenWildcard
import org.elasticsearch.action.admin.indices.close.CloseIndexResponse; //导入依赖的package包/类
public void testCloseOpenWildcard() {
Client client = client();
createIndex("test1", "test2", "a");
ClusterHealthResponse healthResponse = client.admin().cluster().prepareHealth().setWaitForGreenStatus().execute().actionGet();
assertThat(healthResponse.isTimedOut(), equalTo(false));
CloseIndexResponse closeIndexResponse = client.admin().indices().prepareClose("test*").execute().actionGet();
assertThat(closeIndexResponse.isAcknowledged(), equalTo(true));
assertIndexIsClosed("test1", "test2");
assertIndexIsOpened("a");
OpenIndexResponse openIndexResponse = client.admin().indices().prepareOpen("test*").execute().actionGet();
assertThat(openIndexResponse.isAcknowledged(), equalTo(true));
assertIndexIsOpened("test1", "test2", "a");
}
示例8: testCloseOpenAll
import org.elasticsearch.action.admin.indices.close.CloseIndexResponse; //导入依赖的package包/类
public void testCloseOpenAll() {
Client client = client();
createIndex("test1", "test2", "test3");
ClusterHealthResponse healthResponse = client.admin().cluster().prepareHealth().setWaitForGreenStatus().execute().actionGet();
assertThat(healthResponse.isTimedOut(), equalTo(false));
CloseIndexResponse closeIndexResponse = client.admin().indices().prepareClose("_all").execute().actionGet();
assertThat(closeIndexResponse.isAcknowledged(), equalTo(true));
assertIndexIsClosed("test1", "test2", "test3");
OpenIndexResponse openIndexResponse = client.admin().indices().prepareOpen("_all").execute().actionGet();
assertThat(openIndexResponse.isAcknowledged(), equalTo(true));
assertIndexIsOpened("test1", "test2", "test3");
}
示例9: testCloseOpenAllWildcard
import org.elasticsearch.action.admin.indices.close.CloseIndexResponse; //导入依赖的package包/类
public void testCloseOpenAllWildcard() {
Client client = client();
createIndex("test1", "test2", "test3");
ClusterHealthResponse healthResponse = client.admin().cluster().prepareHealth().setWaitForGreenStatus().execute().actionGet();
assertThat(healthResponse.isTimedOut(), equalTo(false));
CloseIndexResponse closeIndexResponse = client.admin().indices().prepareClose("*").execute().actionGet();
assertThat(closeIndexResponse.isAcknowledged(), equalTo(true));
assertIndexIsClosed("test1", "test2", "test3");
OpenIndexResponse openIndexResponse = client.admin().indices().prepareOpen("*").execute().actionGet();
assertThat(openIndexResponse.isAcknowledged(), equalTo(true));
assertIndexIsOpened("test1", "test2", "test3");
}
示例10: testCloseIndexNoAcknowledgement
import org.elasticsearch.action.admin.indices.close.CloseIndexResponse; //导入依赖的package包/类
public void testCloseIndexNoAcknowledgement() {
createIndex("test");
ensureGreen();
CloseIndexResponse closeIndexResponse = client().admin().indices().prepareClose("test").setTimeout("0s").get();
assertThat(closeIndexResponse.isAcknowledged(), equalTo(false));
}
示例11: testOpenIndexNoAcknowledgement
import org.elasticsearch.action.admin.indices.close.CloseIndexResponse; //导入依赖的package包/类
public void testOpenIndexNoAcknowledgement() {
createIndex("test");
ensureGreen();
removePublishTimeout();
CloseIndexResponse closeIndexResponse = client().admin().indices().prepareClose("test").execute().actionGet();
assertThat(closeIndexResponse.isAcknowledged(), equalTo(true));
OpenIndexResponse openIndexResponse = client().admin().indices().prepareOpen("test").setTimeout("0s").get();
assertThat(openIndexResponse.isAcknowledged(), equalTo(false));
ensureGreen("test"); // make sure that recovery from disk has completed, so that check index doesn't fail.
}
示例12: handleRequest
import org.elasticsearch.action.admin.indices.close.CloseIndexResponse; //导入依赖的package包/类
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
CloseIndexRequest closeIndexRequest = new CloseIndexRequest(Strings.splitStringByCommaToArray(request.param("index")));
closeIndexRequest.masterNodeTimeout(request.paramAsTime("master_timeout", closeIndexRequest.masterNodeTimeout()));
closeIndexRequest.timeout(request.paramAsTime("timeout", closeIndexRequest.timeout()));
closeIndexRequest.indicesOptions(IndicesOptions.fromRequest(request, closeIndexRequest.indicesOptions()));
client.admin().indices().close(closeIndexRequest, new AcknowledgedRestListener<CloseIndexResponse>(channel));
}
示例13: closeAllIndices
import org.elasticsearch.action.admin.indices.close.CloseIndexResponse; //导入依赖的package包/类
public void closeAllIndices() {
CloseIndexResponse closeIndexResponse = internalClient.admin().indices().prepareClose("_all")//
.setIndicesOptions(IndicesOptions.fromOptions(false, true, true, true))//
.get();
if (!closeIndexResponse.isAcknowledged())
throw Exceptions.runtime(//
"close all indices not acknowledged by the cluster");
}
示例14: should_open_index
import org.elasticsearch.action.admin.indices.close.CloseIndexResponse; //导入依赖的package包/类
@Test
public void should_open_index() throws Exception {
CloseIndexResponse closeIndexResponse = transportClient.admin().indices().close(new CloseIndexRequest(THE_INDEX)).actionGet();
Assertions.assertThat(closeIndexResponse.isAcknowledged()).isTrue();
OpenIndexResponse openIndexResponse = httpClient.admin().indices().open(new OpenIndexRequest(THE_INDEX)).get();
Assertions.assertThat(openIndexResponse.isAcknowledged()).isTrue();
transportClient.admin().indices().recoveries(new RecoveryRequest(THE_INDEX)).actionGet();
}
示例15: should_fail_when_no_index_specified
import org.elasticsearch.action.admin.indices.close.CloseIndexResponse; //导入依赖的package包/类
@Test
public void should_fail_when_no_index_specified() throws Exception {
CloseIndexResponse closeIndexResponse = transportClient.admin().indices().close(new CloseIndexRequest(THE_INDEX)).actionGet();
Assertions.assertThat(closeIndexResponse.isAcknowledged()).isTrue();
try {
httpClient.admin().indices().open(new OpenIndexRequest()).get();
} catch (Exception e) {
Assertions.assertThat(e).hasMessageContaining("ActionRequestValidationException");
Assertions.assertThat(e).hasMessageContaining("index is missing");
}
}