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


Java OpenIndexResponse类代码示例

本文整理汇总了Java中org.elasticsearch.action.admin.indices.open.OpenIndexResponse的典型用法代码示例。如果您正苦于以下问题:Java OpenIndexResponse类的具体用法?Java OpenIndexResponse怎么用?Java OpenIndexResponse使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


OpenIndexResponse类属于org.elasticsearch.action.admin.indices.open包,在下文中一共展示了OpenIndexResponse类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testCloseOpenMultipleIndices

import org.elasticsearch.action.admin.indices.open.OpenIndexResponse; //导入依赖的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: testSimpleCloseOpenAlias

import org.elasticsearch.action.admin.indices.open.OpenIndexResponse; //导入依赖的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

示例3: testCloseOpenAliasMultipleIndices

import org.elasticsearch.action.admin.indices.open.OpenIndexResponse; //导入依赖的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

示例4: prepareRequest

import org.elasticsearch.action.admin.indices.open.OpenIndexResponse; //导入依赖的package包/类
@Override
public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException {
    OpenIndexRequest openIndexRequest = new OpenIndexRequest(Strings.splitStringByCommaToArray(request.param("index")));
    openIndexRequest.timeout(request.paramAsTime("timeout", openIndexRequest.timeout()));
    openIndexRequest.masterNodeTimeout(request.paramAsTime("master_timeout", openIndexRequest.masterNodeTimeout()));
    openIndexRequest.indicesOptions(IndicesOptions.fromRequest(request, openIndexRequest.indicesOptions()));
    return channel -> client.admin().indices().open(openIndexRequest, new AcknowledgedRestListener<OpenIndexResponse>(channel));
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:9,代码来源:RestOpenIndexAction.java

示例5: testSimpleCloseOpen

import org.elasticsearch.action.admin.indices.open.OpenIndexResponse; //导入依赖的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: testOpenOneMissingIndexIgnoreMissing

import org.elasticsearch.action.admin.indices.open.OpenIndexResponse; //导入依赖的package包/类
public void testOpenOneMissingIndexIgnoreMissing() {
    Client client = client();
    createIndex("test1");
    ClusterHealthResponse healthResponse = client.admin().cluster().prepareHealth().setWaitForGreenStatus().execute().actionGet();
    assertThat(healthResponse.isTimedOut(), equalTo(false));
    OpenIndexResponse openIndexResponse = client.admin().indices().prepareOpen("test1", "test2")
            .setIndicesOptions(IndicesOptions.lenientExpandOpen()).execute().actionGet();
    assertThat(openIndexResponse.isAcknowledged(), equalTo(true));
    assertIndexIsOpened("test1");
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:11,代码来源:OpenCloseIndexIT.java

示例7: testCloseOpenWildcard

import org.elasticsearch.action.admin.indices.open.OpenIndexResponse; //导入依赖的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.open.OpenIndexResponse; //导入依赖的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.open.OpenIndexResponse; //导入依赖的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: testOpenAlreadyOpenedIndex

import org.elasticsearch.action.admin.indices.open.OpenIndexResponse; //导入依赖的package包/类
public void testOpenAlreadyOpenedIndex() {
    Client client = client();
    createIndex("test1");
    ClusterHealthResponse healthResponse = client.admin().cluster().prepareHealth().setWaitForGreenStatus().execute().actionGet();
    assertThat(healthResponse.isTimedOut(), equalTo(false));

    //no problem if we try to open an index that's already in open state
    OpenIndexResponse openIndexResponse1 = client.admin().indices().prepareOpen("test1").execute().actionGet();
    assertThat(openIndexResponse1.isAcknowledged(), equalTo(true));
    assertIndexIsOpened("test1");
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:12,代码来源:OpenCloseIndexIT.java

示例11: testOpenIndexNoAcknowledgement

import org.elasticsearch.action.admin.indices.open.OpenIndexResponse; //导入依赖的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.open.OpenIndexResponse; //导入依赖的package包/类
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
    OpenIndexRequest openIndexRequest = new OpenIndexRequest(Strings.splitStringByCommaToArray(request.param("index")));
    openIndexRequest.timeout(request.paramAsTime("timeout", openIndexRequest.timeout()));
    openIndexRequest.masterNodeTimeout(request.paramAsTime("master_timeout", openIndexRequest.masterNodeTimeout()));
    openIndexRequest.indicesOptions(IndicesOptions.fromRequest(request, openIndexRequest.indicesOptions()));
    client.admin().indices().open(openIndexRequest, new AcknowledgedRestListener<OpenIndexResponse>(channel));
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:9,代码来源:RestOpenIndexAction.java

示例13: openIndex

import org.elasticsearch.action.admin.indices.open.OpenIndexResponse; //导入依赖的package包/类
public OpenIndexResponse openIndex(final String index,
        final BuilderCallback<OpenIndexRequestBuilder> builder) {
    final OpenIndexResponse actionGet = builder
            .apply(client().admin().indices().prepareOpen(index)).execute()
            .actionGet();
    if (!actionGet.isAcknowledged()) {
        onFailure("Failed to open " + index + ".", actionGet);
    }
    return actionGet;
}
 
开发者ID:codelibs,项目名称:elasticsearch-cluster-runner,代码行数:11,代码来源:ElasticsearchClusterRunner.java

示例14: mergeIndexSettings

import org.elasticsearch.action.admin.indices.open.OpenIndexResponse; //导入依赖的package包/类
/**
 * Create a new index in ElasticSearch
 * @param index Index name
 * @throws Exception
 */
private void mergeIndexSettings(String index) throws Exception {
	if (logger.isTraceEnabled()){
		logger.trace("mergeIndexSettings("+index+")");
	}
	if (logger.isDebugEnabled()){
		logger.debug("Index " + index + " already exists. Trying to merge settings.");
	}
	
	checkClient();

       // If there are settings for this index, we use it. If not, using Elasticsearch defaults.
       String source = readUpdateIndexSettings(index);
       if (source != null) {
           if (logger.isTraceEnabled()){
           	logger.trace("Found settings for index "+index+" : " + source);
           }

           CloseIndexResponse closeIndexResponse = client.admin().indices().prepareClose(index).execute().actionGet();
           if (!closeIndexResponse.isAcknowledged()){
           	throw new Exception("Could not close index ["+index+"].");
           }

           client.admin().indices().prepareUpdateSettings(index).setSettings(source).execute().actionGet();

           OpenIndexResponse openIndexResponse = client.admin().indices().prepareOpen(index).execute().actionGet();
           if (!openIndexResponse.isAcknowledged()){
           	throw new Exception("Could not open index ["+index+"].");
           }
	}
	

	if (logger.isTraceEnabled()){
		logger.trace("/mergeIndexSettings("+index+")");
	}
}
 
开发者ID:yamingd,项目名称:argo,代码行数:41,代码来源:ElasticsearchAbstractClientFactoryBean.java

示例15: toXContent

import org.elasticsearch.action.admin.indices.open.OpenIndexResponse; //导入依赖的package包/类
@Override
protected XContentBuilder toXContent(OpenIndexRequest request, OpenIndexResponse response, XContentBuilder builder) throws IOException {
    return builder.startObject()
            .field(Fields.OK, true)
            .field(Fields.ACKNOWLEDGED, response.isAcknowledged())
            .endObject();
}
 
开发者ID:javanna,项目名称:elasticshell,代码行数:8,代码来源:OpenIndexRequestBuilder.java


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