use of org.elasticsearch.action.admin.indices.open.OpenIndexResponse in project elasticsearch by elastic.
the class RestOpenIndexAction method prepareRequest.
@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));
}
use of org.elasticsearch.action.admin.indices.open.OpenIndexResponse in project elasticsearch by elastic.
the class AckClusterUpdateSettingsIT method testOpenIndexNoAcknowledgement.
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));
// make sure that recovery from disk has completed, so that check index doesn't fail.
ensureGreen("test");
}
use of org.elasticsearch.action.admin.indices.open.OpenIndexResponse in project elasticsearch by elastic.
the class OpenCloseIndexIT method testCloseOpenMultipleIndices.
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");
}
use of org.elasticsearch.action.admin.indices.open.OpenIndexResponse in project elasticsearch by elastic.
the class OpenCloseIndexIT method testCloseOpenAliasMultipleIndices.
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");
}
use of org.elasticsearch.action.admin.indices.open.OpenIndexResponse in project elasticsearch by elastic.
the class OpenCloseIndexIT method testSimpleCloseOpenAlias.
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");
}
Aggregations