当前位置: 首页>>代码示例>>Java>>正文


Java CloseIndexResponse类代码示例

本文整理汇总了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");
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:20,代码来源:OpenCloseIndexIT.java

示例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");
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:17,代码来源:OpenCloseIndexIT.java

示例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");
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:18,代码来源:OpenCloseIndexIT.java

示例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");
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:20,代码来源:OpenCloseIndexIT.java

示例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");
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:15,代码来源:OpenCloseIndexIT.java

示例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");
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:11,代码来源:OpenCloseIndexIT.java

示例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");
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:16,代码来源:OpenCloseIndexIT.java

示例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");
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:15,代码来源:OpenCloseIndexIT.java

示例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");
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:15,代码来源:OpenCloseIndexIT.java

示例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));
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:8,代码来源:AckIT.java

示例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.
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:12,代码来源:AckClusterUpdateSettingsIT.java

示例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));
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:9,代码来源:RestCloseIndexAction.java

示例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");
}
 
开发者ID:spacedog-io,项目名称:spacedog-server,代码行数:10,代码来源:ElasticClient.java

示例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();
}
 
开发者ID:obourgain,项目名称:elasticsearch-http,代码行数:11,代码来源:OpenIndexActionHandlerTest.java

示例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");
    }
}
 
开发者ID:obourgain,项目名称:elasticsearch-http,代码行数:13,代码来源:OpenIndexActionHandlerTest.java


注:本文中的org.elasticsearch.action.admin.indices.close.CloseIndexResponse类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。