diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/TransportActionModule.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/TransportActionModule.java
index d100cf1f522..330fb094c6a 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/TransportActionModule.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/TransportActionModule.java
@@ -32,12 +32,14 @@ import org.elasticsearch.action.admin.cluster.ping.single.TransportSinglePingAct
import org.elasticsearch.action.admin.cluster.state.TransportClusterStateAction;
import org.elasticsearch.action.admin.indices.alias.TransportIndicesAliasesAction;
import org.elasticsearch.action.admin.indices.cache.clear.TransportClearIndicesCacheAction;
+import org.elasticsearch.action.admin.indices.close.TransportCloseIndexAction;
import org.elasticsearch.action.admin.indices.create.TransportCreateIndexAction;
import org.elasticsearch.action.admin.indices.delete.TransportDeleteIndexAction;
import org.elasticsearch.action.admin.indices.flush.TransportFlushAction;
import org.elasticsearch.action.admin.indices.gateway.snapshot.TransportGatewaySnapshotAction;
import org.elasticsearch.action.admin.indices.mapping.delete.TransportDeleteMappingAction;
import org.elasticsearch.action.admin.indices.mapping.put.TransportPutMappingAction;
+import org.elasticsearch.action.admin.indices.open.TransportOpenIndexAction;
import org.elasticsearch.action.admin.indices.optimize.TransportOptimizeAction;
import org.elasticsearch.action.admin.indices.refresh.TransportRefreshAction;
import org.elasticsearch.action.admin.indices.settings.TransportUpdateSettingsAction;
@@ -80,6 +82,8 @@ public class TransportActionModule extends AbstractModule {
bind(TransportIndicesStatusAction.class).asEagerSingleton();
bind(TransportCreateIndexAction.class).asEagerSingleton();
bind(TransportDeleteIndexAction.class).asEagerSingleton();
+ bind(TransportOpenIndexAction.class).asEagerSingleton();
+ bind(TransportCloseIndexAction.class).asEagerSingleton();
bind(TransportPutMappingAction.class).asEagerSingleton();
bind(TransportDeleteMappingAction.class).asEagerSingleton();
bind(TransportIndicesAliasesAction.class).asEagerSingleton();
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/TransportActions.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/TransportActions.java
index 56117ae93bb..4000be63f61 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/TransportActions.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/TransportActions.java
@@ -49,6 +49,8 @@ public class TransportActions {
public static class Indices {
public static final String CREATE = "indices/createIndex";
public static final String DELETE = "indices/deleteIndex";
+ public static final String OPEN = "indices/openIndex";
+ public static final String CLOSE = "indices/closeIndex";
public static final String FLUSH = "indices/flush";
public static final String REFRESH = "indices/refresh";
public static final String OPTIMIZE = "indices/optimize";
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/close/CloseIndexRequest.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/close/CloseIndexRequest.java
new file mode 100644
index 00000000000..068074735fd
--- /dev/null
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/close/CloseIndexRequest.java
@@ -0,0 +1,105 @@
+/*
+ * Licensed to Elastic Search and Shay Banon under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. Elastic Search licenses this
+ * file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.elasticsearch.action.admin.indices.close;
+
+import org.elasticsearch.action.ActionRequestValidationException;
+import org.elasticsearch.action.support.master.MasterNodeOperationRequest;
+import org.elasticsearch.common.io.stream.StreamInput;
+import org.elasticsearch.common.io.stream.StreamOutput;
+import org.elasticsearch.common.unit.TimeValue;
+
+import java.io.IOException;
+
+import static org.elasticsearch.action.Actions.*;
+import static org.elasticsearch.common.unit.TimeValue.*;
+
+/**
+ * A request to close an index.
+ *
+ * @author kimchy (shay.banon)
+ */
+public class CloseIndexRequest extends MasterNodeOperationRequest {
+
+ private String index;
+
+ private TimeValue timeout = timeValueSeconds(10);
+
+ CloseIndexRequest() {
+ }
+
+ /**
+ * Constructs a new delete index request for the specified index.
+ */
+ public CloseIndexRequest(String index) {
+ this.index = index;
+ }
+
+ @Override public ActionRequestValidationException validate() {
+ ActionRequestValidationException validationException = null;
+ if (index == null) {
+ validationException = addValidationError("index is missing", validationException);
+ }
+ return validationException;
+ }
+
+ /**
+ * The index to delete.
+ */
+ String index() {
+ return index;
+ }
+
+ /**
+ * Timeout to wait for the index deletion to be acknowledged by current cluster nodes. Defaults
+ * to 10s.
+ */
+ TimeValue timeout() {
+ return timeout;
+ }
+
+ /**
+ * Timeout to wait for the index deletion to be acknowledged by current cluster nodes. Defaults
+ * to 10s.
+ */
+ public CloseIndexRequest timeout(TimeValue timeout) {
+ this.timeout = timeout;
+ return this;
+ }
+
+ /**
+ * Timeout to wait for the index deletion to be acknowledged by current cluster nodes. Defaults
+ * to 10s.
+ */
+ public CloseIndexRequest timeout(String timeout) {
+ return timeout(TimeValue.parseTimeValue(timeout, null));
+ }
+
+ @Override public void readFrom(StreamInput in) throws IOException {
+ super.readFrom(in);
+ index = in.readUTF();
+ timeout = readTimeValue(in);
+ }
+
+ @Override public void writeTo(StreamOutput out) throws IOException {
+ super.writeTo(out);
+ out.writeUTF(index);
+ timeout.writeTo(out);
+ }
+}
\ No newline at end of file
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/close/CloseIndexResponse.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/close/CloseIndexResponse.java
new file mode 100644
index 00000000000..ce1524b194c
--- /dev/null
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/close/CloseIndexResponse.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to Elastic Search and Shay Banon under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. Elastic Search licenses this
+ * file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.elasticsearch.action.admin.indices.close;
+
+import org.elasticsearch.action.ActionResponse;
+import org.elasticsearch.common.io.stream.StreamInput;
+import org.elasticsearch.common.io.stream.StreamOutput;
+import org.elasticsearch.common.io.stream.Streamable;
+
+import java.io.IOException;
+
+/**
+ * A response for a close index action.
+ *
+ * @author kimchy (shay.banon)
+ */
+public class CloseIndexResponse implements ActionResponse, Streamable {
+
+ private boolean acknowledged;
+
+ CloseIndexResponse() {
+ }
+
+ CloseIndexResponse(boolean acknowledged) {
+ this.acknowledged = acknowledged;
+ }
+
+ public boolean acknowledged() {
+ return acknowledged;
+ }
+
+ public boolean getAcknowledged() {
+ return acknowledged();
+ }
+
+ @Override public void readFrom(StreamInput in) throws IOException {
+ acknowledged = in.readBoolean();
+ }
+
+ @Override public void writeTo(StreamOutput out) throws IOException {
+ out.writeBoolean(acknowledged);
+ }
+}
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/close/TransportCloseIndexAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/close/TransportCloseIndexAction.java
new file mode 100644
index 00000000000..b6a54e55a46
--- /dev/null
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/close/TransportCloseIndexAction.java
@@ -0,0 +1,100 @@
+/*
+ * Licensed to Elastic Search and Shay Banon under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. Elastic Search licenses this
+ * file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.elasticsearch.action.admin.indices.close;
+
+import org.elasticsearch.ElasticSearchException;
+import org.elasticsearch.action.TransportActions;
+import org.elasticsearch.action.support.master.TransportMasterNodeOperationAction;
+import org.elasticsearch.cluster.ClusterService;
+import org.elasticsearch.cluster.ClusterState;
+import org.elasticsearch.cluster.block.ClusterBlockLevel;
+import org.elasticsearch.cluster.metadata.MetaDataStateIndexService;
+import org.elasticsearch.common.inject.Inject;
+import org.elasticsearch.common.settings.Settings;
+import org.elasticsearch.threadpool.ThreadPool;
+import org.elasticsearch.transport.TransportService;
+
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.atomic.AtomicReference;
+
+/**
+ * Delete index action.
+ *
+ * @author kimchy (shay.banon)
+ */
+public class TransportCloseIndexAction extends TransportMasterNodeOperationAction {
+
+ private final MetaDataStateIndexService stateIndexService;
+
+ @Inject public TransportCloseIndexAction(Settings settings, TransportService transportService, ClusterService clusterService,
+ ThreadPool threadPool, MetaDataStateIndexService stateIndexService) {
+ super(settings, transportService, clusterService, threadPool);
+ this.stateIndexService = stateIndexService;
+ }
+
+ @Override protected String transportAction() {
+ return TransportActions.Admin.Indices.CLOSE;
+ }
+
+ @Override protected CloseIndexRequest newRequest() {
+ return new CloseIndexRequest();
+ }
+
+ @Override protected CloseIndexResponse newResponse() {
+ return new CloseIndexResponse();
+ }
+
+ @Override protected void checkBlock(CloseIndexRequest request, ClusterState state) {
+ state.blocks().indexBlockedRaiseException(ClusterBlockLevel.METADATA, request.index());
+ }
+
+ @Override protected CloseIndexResponse masterOperation(CloseIndexRequest request, ClusterState state) throws ElasticSearchException {
+ final AtomicReference responseRef = new AtomicReference();
+ final AtomicReference failureRef = new AtomicReference();
+ final CountDownLatch latch = new CountDownLatch(1);
+ stateIndexService.closeIndex(new MetaDataStateIndexService.Request(request.index()).timeout(request.timeout()), new MetaDataStateIndexService.Listener() {
+ @Override public void onResponse(MetaDataStateIndexService.Response response) {
+ responseRef.set(new CloseIndexResponse(response.acknowledged()));
+ latch.countDown();
+ }
+
+ @Override public void onFailure(Throwable t) {
+ failureRef.set(t);
+ latch.countDown();
+ }
+ });
+
+ try {
+ latch.await();
+ } catch (InterruptedException e) {
+ failureRef.set(e);
+ }
+
+ if (failureRef.get() != null) {
+ if (failureRef.get() instanceof ElasticSearchException) {
+ throw (ElasticSearchException) failureRef.get();
+ } else {
+ throw new ElasticSearchException(failureRef.get().getMessage(), failureRef.get());
+ }
+ }
+
+ return responseRef.get();
+ }
+}
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/open/OpenIndexRequest.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/open/OpenIndexRequest.java
new file mode 100644
index 00000000000..2052fcb7e93
--- /dev/null
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/open/OpenIndexRequest.java
@@ -0,0 +1,105 @@
+/*
+ * Licensed to Elastic Search and Shay Banon under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. Elastic Search licenses this
+ * file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.elasticsearch.action.admin.indices.open;
+
+import org.elasticsearch.action.ActionRequestValidationException;
+import org.elasticsearch.action.support.master.MasterNodeOperationRequest;
+import org.elasticsearch.common.io.stream.StreamInput;
+import org.elasticsearch.common.io.stream.StreamOutput;
+import org.elasticsearch.common.unit.TimeValue;
+
+import java.io.IOException;
+
+import static org.elasticsearch.action.Actions.*;
+import static org.elasticsearch.common.unit.TimeValue.*;
+
+/**
+ * A request to open an index.
+ *
+ * @author kimchy (shay.banon)
+ */
+public class OpenIndexRequest extends MasterNodeOperationRequest {
+
+ private String index;
+
+ private TimeValue timeout = timeValueSeconds(10);
+
+ OpenIndexRequest() {
+ }
+
+ /**
+ * Constructs a new delete index request for the specified index.
+ */
+ public OpenIndexRequest(String index) {
+ this.index = index;
+ }
+
+ @Override public ActionRequestValidationException validate() {
+ ActionRequestValidationException validationException = null;
+ if (index == null) {
+ validationException = addValidationError("index is missing", validationException);
+ }
+ return validationException;
+ }
+
+ /**
+ * The index to delete.
+ */
+ String index() {
+ return index;
+ }
+
+ /**
+ * Timeout to wait for the index deletion to be acknowledged by current cluster nodes. Defaults
+ * to 10s.
+ */
+ TimeValue timeout() {
+ return timeout;
+ }
+
+ /**
+ * Timeout to wait for the index deletion to be acknowledged by current cluster nodes. Defaults
+ * to 10s.
+ */
+ public OpenIndexRequest timeout(TimeValue timeout) {
+ this.timeout = timeout;
+ return this;
+ }
+
+ /**
+ * Timeout to wait for the index deletion to be acknowledged by current cluster nodes. Defaults
+ * to 10s.
+ */
+ public OpenIndexRequest timeout(String timeout) {
+ return timeout(TimeValue.parseTimeValue(timeout, null));
+ }
+
+ @Override public void readFrom(StreamInput in) throws IOException {
+ super.readFrom(in);
+ index = in.readUTF();
+ timeout = readTimeValue(in);
+ }
+
+ @Override public void writeTo(StreamOutput out) throws IOException {
+ super.writeTo(out);
+ out.writeUTF(index);
+ timeout.writeTo(out);
+ }
+}
\ No newline at end of file
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/open/OpenIndexResponse.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/open/OpenIndexResponse.java
new file mode 100644
index 00000000000..4c928bdd6a3
--- /dev/null
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/open/OpenIndexResponse.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to Elastic Search and Shay Banon under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. Elastic Search licenses this
+ * file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.elasticsearch.action.admin.indices.open;
+
+import org.elasticsearch.action.ActionResponse;
+import org.elasticsearch.common.io.stream.StreamInput;
+import org.elasticsearch.common.io.stream.StreamOutput;
+import org.elasticsearch.common.io.stream.Streamable;
+
+import java.io.IOException;
+
+/**
+ * A response for a open index action.
+ *
+ * @author kimchy (shay.banon)
+ */
+public class OpenIndexResponse implements ActionResponse, Streamable {
+
+ private boolean acknowledged;
+
+ OpenIndexResponse() {
+ }
+
+ OpenIndexResponse(boolean acknowledged) {
+ this.acknowledged = acknowledged;
+ }
+
+ public boolean acknowledged() {
+ return acknowledged;
+ }
+
+ public boolean getAcknowledged() {
+ return acknowledged();
+ }
+
+ @Override public void readFrom(StreamInput in) throws IOException {
+ acknowledged = in.readBoolean();
+ }
+
+ @Override public void writeTo(StreamOutput out) throws IOException {
+ out.writeBoolean(acknowledged);
+ }
+}
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/open/TransportOpenIndexAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/open/TransportOpenIndexAction.java
new file mode 100644
index 00000000000..27feb45a2f0
--- /dev/null
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/open/TransportOpenIndexAction.java
@@ -0,0 +1,100 @@
+/*
+ * Licensed to Elastic Search and Shay Banon under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. Elastic Search licenses this
+ * file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.elasticsearch.action.admin.indices.open;
+
+import org.elasticsearch.ElasticSearchException;
+import org.elasticsearch.action.TransportActions;
+import org.elasticsearch.action.support.master.TransportMasterNodeOperationAction;
+import org.elasticsearch.cluster.ClusterService;
+import org.elasticsearch.cluster.ClusterState;
+import org.elasticsearch.cluster.block.ClusterBlockLevel;
+import org.elasticsearch.cluster.metadata.MetaDataStateIndexService;
+import org.elasticsearch.common.inject.Inject;
+import org.elasticsearch.common.settings.Settings;
+import org.elasticsearch.threadpool.ThreadPool;
+import org.elasticsearch.transport.TransportService;
+
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.atomic.AtomicReference;
+
+/**
+ * Delete index action.
+ *
+ * @author kimchy (shay.banon)
+ */
+public class TransportOpenIndexAction extends TransportMasterNodeOperationAction {
+
+ private final MetaDataStateIndexService stateIndexService;
+
+ @Inject public TransportOpenIndexAction(Settings settings, TransportService transportService, ClusterService clusterService,
+ ThreadPool threadPool, MetaDataStateIndexService stateIndexService) {
+ super(settings, transportService, clusterService, threadPool);
+ this.stateIndexService = stateIndexService;
+ }
+
+ @Override protected String transportAction() {
+ return TransportActions.Admin.Indices.OPEN;
+ }
+
+ @Override protected OpenIndexRequest newRequest() {
+ return new OpenIndexRequest();
+ }
+
+ @Override protected OpenIndexResponse newResponse() {
+ return new OpenIndexResponse();
+ }
+
+ @Override protected void checkBlock(OpenIndexRequest request, ClusterState state) {
+ state.blocks().indexBlockedRaiseException(ClusterBlockLevel.METADATA, request.index());
+ }
+
+ @Override protected OpenIndexResponse masterOperation(OpenIndexRequest request, ClusterState state) throws ElasticSearchException {
+ final AtomicReference responseRef = new AtomicReference();
+ final AtomicReference failureRef = new AtomicReference();
+ final CountDownLatch latch = new CountDownLatch(1);
+ stateIndexService.openIndex(new MetaDataStateIndexService.Request(request.index()).timeout(request.timeout()), new MetaDataStateIndexService.Listener() {
+ @Override public void onResponse(MetaDataStateIndexService.Response response) {
+ responseRef.set(new OpenIndexResponse(response.acknowledged()));
+ latch.countDown();
+ }
+
+ @Override public void onFailure(Throwable t) {
+ failureRef.set(t);
+ latch.countDown();
+ }
+ });
+
+ try {
+ latch.await();
+ } catch (InterruptedException e) {
+ failureRef.set(e);
+ }
+
+ if (failureRef.get() != null) {
+ if (failureRef.get() instanceof ElasticSearchException) {
+ throw (ElasticSearchException) failureRef.get();
+ } else {
+ throw new ElasticSearchException(failureRef.get().getMessage(), failureRef.get());
+ }
+ }
+
+ return responseRef.get();
+ }
+}
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/client/IndicesAdminClient.java b/modules/elasticsearch/src/main/java/org/elasticsearch/client/IndicesAdminClient.java
index 0c526ce4d93..fe5a6376ed3 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/client/IndicesAdminClient.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/client/IndicesAdminClient.java
@@ -25,6 +25,8 @@ import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest;
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesResponse;
import org.elasticsearch.action.admin.indices.cache.clear.ClearIndicesCacheRequest;
import org.elasticsearch.action.admin.indices.cache.clear.ClearIndicesCacheResponse;
+import org.elasticsearch.action.admin.indices.close.CloseIndexRequest;
+import org.elasticsearch.action.admin.indices.close.CloseIndexResponse;
import org.elasticsearch.action.admin.indices.create.CreateIndexRequest;
import org.elasticsearch.action.admin.indices.create.CreateIndexResponse;
import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest;
@@ -37,6 +39,8 @@ import org.elasticsearch.action.admin.indices.mapping.delete.DeleteMappingReques
import org.elasticsearch.action.admin.indices.mapping.delete.DeleteMappingResponse;
import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest;
import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse;
+import org.elasticsearch.action.admin.indices.open.OpenIndexRequest;
+import org.elasticsearch.action.admin.indices.open.OpenIndexResponse;
import org.elasticsearch.action.admin.indices.optimize.OptimizeRequest;
import org.elasticsearch.action.admin.indices.optimize.OptimizeResponse;
import org.elasticsearch.action.admin.indices.refresh.RefreshRequest;
@@ -47,12 +51,14 @@ import org.elasticsearch.action.admin.indices.status.IndicesStatusRequest;
import org.elasticsearch.action.admin.indices.status.IndicesStatusResponse;
import org.elasticsearch.client.action.admin.indices.alias.IndicesAliasesRequestBuilder;
import org.elasticsearch.client.action.admin.indices.cache.clear.ClearIndicesCacheRequestBuilder;
+import org.elasticsearch.client.action.admin.indices.close.CloseIndexRequestBuilder;
import org.elasticsearch.client.action.admin.indices.create.CreateIndexRequestBuilder;
import org.elasticsearch.client.action.admin.indices.delete.DeleteIndexRequestBuilder;
import org.elasticsearch.client.action.admin.indices.flush.FlushRequestBuilder;
import org.elasticsearch.client.action.admin.indices.gateway.snapshot.GatewaySnapshotRequestBuilder;
import org.elasticsearch.client.action.admin.indices.mapping.delete.DeleteMappingRequestBuilder;
import org.elasticsearch.client.action.admin.indices.mapping.put.PutMappingRequestBuilder;
+import org.elasticsearch.client.action.admin.indices.open.OpenIndexRequestBuilder;
import org.elasticsearch.client.action.admin.indices.optimize.OptimizeRequestBuilder;
import org.elasticsearch.client.action.admin.indices.refresh.RefreshRequestBuilder;
import org.elasticsearch.client.action.admin.indices.settings.UpdateSettingsRequestBuilder;
@@ -139,6 +145,56 @@ public interface IndicesAdminClient {
*/
DeleteIndexRequestBuilder prepareDelete(String index);
+ /**
+ * Closes an index based on the index name.
+ *
+ * @param request The close index request
+ * @return The result future
+ * @see org.elasticsearch.client.Requests#closeIndexRequest(String)
+ */
+ ActionFuture close(CloseIndexRequest request);
+
+ /**
+ * Closes an index based on the index name.
+ *
+ * @param request The close index request
+ * @param listener A listener to be notified with a result
+ * @see org.elasticsearch.client.Requests#closeIndexRequest(String)
+ */
+ void close(CloseIndexRequest request, ActionListener listener);
+
+ /**
+ * Closes an index based on the index name.
+ *
+ * @param index The index name to close
+ */
+ CloseIndexRequestBuilder prepareClose(String index);
+
+ /**
+ * OPen an index based on the index name.
+ *
+ * @param request The close index request
+ * @return The result future
+ * @see org.elasticsearch.client.Requests#openIndexRequest(String)
+ */
+ ActionFuture open(OpenIndexRequest request);
+
+ /**
+ * Open an index based on the index name.
+ *
+ * @param request The close index request
+ * @param listener A listener to be notified with a result
+ * @see org.elasticsearch.client.Requests#openIndexRequest(String)
+ */
+ void open(OpenIndexRequest request, ActionListener listener);
+
+ /**
+ * Opens an index based on the index name.
+ *
+ * @param index The index name to close
+ */
+ OpenIndexRequestBuilder prepareOpen(String index);
+
/**
* Explicitly refresh one or more indices (making the content indexed since the last refresh searchable).
*
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/client/Requests.java b/modules/elasticsearch/src/main/java/org/elasticsearch/client/Requests.java
index 578fde0a8e7..159e7540a87 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/client/Requests.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/client/Requests.java
@@ -30,12 +30,14 @@ import org.elasticsearch.action.admin.cluster.ping.single.SinglePingRequest;
import org.elasticsearch.action.admin.cluster.state.ClusterStateRequest;
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest;
import org.elasticsearch.action.admin.indices.cache.clear.ClearIndicesCacheRequest;
+import org.elasticsearch.action.admin.indices.close.CloseIndexRequest;
import org.elasticsearch.action.admin.indices.create.CreateIndexRequest;
import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest;
import org.elasticsearch.action.admin.indices.flush.FlushRequest;
import org.elasticsearch.action.admin.indices.gateway.snapshot.GatewaySnapshotRequest;
import org.elasticsearch.action.admin.indices.mapping.delete.DeleteMappingRequest;
import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest;
+import org.elasticsearch.action.admin.indices.open.OpenIndexRequest;
import org.elasticsearch.action.admin.indices.optimize.OptimizeRequest;
import org.elasticsearch.action.admin.indices.refresh.RefreshRequest;
import org.elasticsearch.action.admin.indices.settings.UpdateSettingsRequest;
@@ -207,6 +209,28 @@ public class Requests {
return new DeleteIndexRequest(index);
}
+ /**
+ * Creates a close index request.
+ *
+ * @param index The index to close
+ * @return The delete index request
+ * @see org.elasticsearch.client.IndicesAdminClient#close(org.elasticsearch.action.admin.indices.close.CloseIndexRequest)
+ */
+ public static CloseIndexRequest closeIndexRequest(String index) {
+ return new CloseIndexRequest(index);
+ }
+
+ /**
+ * Creates an open index request.
+ *
+ * @param index The index to open
+ * @return The delete index request
+ * @see org.elasticsearch.client.IndicesAdminClient#open(org.elasticsearch.action.admin.indices.open.OpenIndexRequest)
+ */
+ public static OpenIndexRequest openIndexRequest(String index) {
+ return new OpenIndexRequest(index);
+ }
+
/**
* Create a create mapping request against one or more indices.
*
@@ -223,7 +247,7 @@ public class Requests {
*
* @param indices The indices the mapping will be deleted from. Use null or _all to execute against all indices
* @return The create mapping request
- * @see org.elasticsearch.client.IndicesAdminClient#deleteMapping(org.elasticsearch.action.admin.indices.mapping.put.DeleteMappingRequest)
+ * @see org.elasticsearch.client.IndicesAdminClient#deleteMapping(org.elasticsearch.action.admin.indices.mapping.delete.DeleteMappingRequest)
*/
public static DeleteMappingRequest deleteMappingRequest(String... indices) {
return new DeleteMappingRequest(indices);
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/client/action/admin/indices/close/CloseIndexRequestBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/client/action/admin/indices/close/CloseIndexRequestBuilder.java
new file mode 100644
index 00000000000..d8517053380
--- /dev/null
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/client/action/admin/indices/close/CloseIndexRequestBuilder.java
@@ -0,0 +1,75 @@
+/*
+ * Licensed to Elastic Search and Shay Banon under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. Elastic Search licenses this
+ * file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.elasticsearch.client.action.admin.indices.close;
+
+import org.elasticsearch.action.ActionListener;
+import org.elasticsearch.action.admin.indices.close.CloseIndexRequest;
+import org.elasticsearch.action.admin.indices.close.CloseIndexResponse;
+import org.elasticsearch.client.IndicesAdminClient;
+import org.elasticsearch.client.action.admin.indices.support.BaseIndicesRequestBuilder;
+import org.elasticsearch.common.unit.TimeValue;
+
+/**
+ * @author kimchy (shay.banon)
+ */
+public class CloseIndexRequestBuilder extends BaseIndicesRequestBuilder {
+
+ public CloseIndexRequestBuilder(IndicesAdminClient indicesClient, String index) {
+ super(indicesClient, new CloseIndexRequest(index));
+ }
+
+ /**
+ * Timeout to wait for the operation to be acknowledged by current cluster nodes. Defaults
+ * to 10s.
+ */
+ public CloseIndexRequestBuilder setTimeout(TimeValue timeout) {
+ request.timeout(timeout);
+ return this;
+ }
+
+ /**
+ * Timeout to wait for the index deletion to be acknowledged by current cluster nodes. Defaults
+ * to 10s.
+ */
+ public CloseIndexRequestBuilder setTimeout(String timeout) {
+ request.timeout(timeout);
+ return this;
+ }
+
+ /**
+ * Sets the master node timeout in case the master has not yet been discovered.
+ */
+ public CloseIndexRequestBuilder setMasterNodeTimeout(TimeValue timeout) {
+ request.masterNodeTimeout(timeout);
+ return this;
+ }
+
+ /**
+ * Sets the master node timeout in case the master has not yet been discovered.
+ */
+ public CloseIndexRequestBuilder setMasterNodeTimeout(String timeout) {
+ request.masterNodeTimeout(timeout);
+ return this;
+ }
+
+ @Override protected void doExecute(ActionListener listener) {
+ client.close(request, listener);
+ }
+}
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/client/action/admin/indices/open/OpenIndexRequestBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/client/action/admin/indices/open/OpenIndexRequestBuilder.java
new file mode 100644
index 00000000000..aeea8fbfe87
--- /dev/null
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/client/action/admin/indices/open/OpenIndexRequestBuilder.java
@@ -0,0 +1,75 @@
+/*
+ * Licensed to Elastic Search and Shay Banon under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. Elastic Search licenses this
+ * file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.elasticsearch.client.action.admin.indices.open;
+
+import org.elasticsearch.action.ActionListener;
+import org.elasticsearch.action.admin.indices.open.OpenIndexRequest;
+import org.elasticsearch.action.admin.indices.open.OpenIndexResponse;
+import org.elasticsearch.client.IndicesAdminClient;
+import org.elasticsearch.client.action.admin.indices.support.BaseIndicesRequestBuilder;
+import org.elasticsearch.common.unit.TimeValue;
+
+/**
+ * @author kimchy (shay.banon)
+ */
+public class OpenIndexRequestBuilder extends BaseIndicesRequestBuilder {
+
+ public OpenIndexRequestBuilder(IndicesAdminClient indicesClient, String index) {
+ super(indicesClient, new OpenIndexRequest(index));
+ }
+
+ /**
+ * Timeout to wait for the operation to be acknowledged by current cluster nodes. Defaults
+ * to 10s.
+ */
+ public OpenIndexRequestBuilder setTimeout(TimeValue timeout) {
+ request.timeout(timeout);
+ return this;
+ }
+
+ /**
+ * Timeout to wait for the index deletion to be acknowledged by current cluster nodes. Defaults
+ * to 10s.
+ */
+ public OpenIndexRequestBuilder setTimeout(String timeout) {
+ request.timeout(timeout);
+ return this;
+ }
+
+ /**
+ * Sets the master node timeout in case the master has not yet been discovered.
+ */
+ public OpenIndexRequestBuilder setMasterNodeTimeout(TimeValue timeout) {
+ request.masterNodeTimeout(timeout);
+ return this;
+ }
+
+ /**
+ * Sets the master node timeout in case the master has not yet been discovered.
+ */
+ public OpenIndexRequestBuilder setMasterNodeTimeout(String timeout) {
+ request.masterNodeTimeout(timeout);
+ return this;
+ }
+
+ @Override protected void doExecute(ActionListener listener) {
+ client.open(request, listener);
+ }
+}
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/client/node/NodeIndicesAdminClient.java b/modules/elasticsearch/src/main/java/org/elasticsearch/client/node/NodeIndicesAdminClient.java
index 0ba16040586..7b8d5f47573 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/client/node/NodeIndicesAdminClient.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/client/node/NodeIndicesAdminClient.java
@@ -27,6 +27,9 @@ import org.elasticsearch.action.admin.indices.alias.TransportIndicesAliasesActio
import org.elasticsearch.action.admin.indices.cache.clear.ClearIndicesCacheRequest;
import org.elasticsearch.action.admin.indices.cache.clear.ClearIndicesCacheResponse;
import org.elasticsearch.action.admin.indices.cache.clear.TransportClearIndicesCacheAction;
+import org.elasticsearch.action.admin.indices.close.CloseIndexRequest;
+import org.elasticsearch.action.admin.indices.close.CloseIndexResponse;
+import org.elasticsearch.action.admin.indices.close.TransportCloseIndexAction;
import org.elasticsearch.action.admin.indices.create.CreateIndexRequest;
import org.elasticsearch.action.admin.indices.create.CreateIndexResponse;
import org.elasticsearch.action.admin.indices.create.TransportCreateIndexAction;
@@ -45,6 +48,9 @@ import org.elasticsearch.action.admin.indices.mapping.delete.TransportDeleteMapp
import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest;
import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse;
import org.elasticsearch.action.admin.indices.mapping.put.TransportPutMappingAction;
+import org.elasticsearch.action.admin.indices.open.OpenIndexRequest;
+import org.elasticsearch.action.admin.indices.open.OpenIndexResponse;
+import org.elasticsearch.action.admin.indices.open.TransportOpenIndexAction;
import org.elasticsearch.action.admin.indices.optimize.OptimizeRequest;
import org.elasticsearch.action.admin.indices.optimize.OptimizeResponse;
import org.elasticsearch.action.admin.indices.optimize.TransportOptimizeAction;
@@ -76,6 +82,10 @@ public class NodeIndicesAdminClient extends AbstractIndicesAdminClient implement
private final TransportDeleteIndexAction deleteIndexAction;
+ private final TransportCloseIndexAction closeIndexAction;
+
+ private final TransportOpenIndexAction openIndexAction;
+
private final TransportRefreshAction refreshAction;
private final TransportFlushAction flushAction;
@@ -96,6 +106,7 @@ public class NodeIndicesAdminClient extends AbstractIndicesAdminClient implement
@Inject public NodeIndicesAdminClient(Settings settings, ThreadPool threadPool, TransportIndicesStatusAction indicesStatusAction,
TransportCreateIndexAction createIndexAction, TransportDeleteIndexAction deleteIndexAction,
+ TransportCloseIndexAction closeIndexAction, TransportOpenIndexAction openIndexAction,
TransportRefreshAction refreshAction, TransportFlushAction flushAction, TransportOptimizeAction optimizeAction,
TransportPutMappingAction putMappingAction, TransportDeleteMappingAction deleteMappingAction, TransportGatewaySnapshotAction gatewaySnapshotAction,
TransportIndicesAliasesAction indicesAliasesAction, TransportClearIndicesCacheAction clearIndicesCacheAction,
@@ -104,6 +115,8 @@ public class NodeIndicesAdminClient extends AbstractIndicesAdminClient implement
this.indicesStatusAction = indicesStatusAction;
this.createIndexAction = createIndexAction;
this.deleteIndexAction = deleteIndexAction;
+ this.closeIndexAction = closeIndexAction;
+ this.openIndexAction = openIndexAction;
this.refreshAction = refreshAction;
this.flushAction = flushAction;
this.optimizeAction = optimizeAction;
@@ -143,6 +156,22 @@ public class NodeIndicesAdminClient extends AbstractIndicesAdminClient implement
deleteIndexAction.execute(request, listener);
}
+ @Override public ActionFuture close(CloseIndexRequest request) {
+ return closeIndexAction.execute(request);
+ }
+
+ @Override public void close(CloseIndexRequest request, ActionListener listener) {
+ closeIndexAction.execute(request, listener);
+ }
+
+ @Override public ActionFuture open(OpenIndexRequest request) {
+ return openIndexAction.execute(request);
+ }
+
+ @Override public void open(OpenIndexRequest request, ActionListener listener) {
+ openIndexAction.execute(request, listener);
+ }
+
@Override public ActionFuture refresh(RefreshRequest request) {
return refreshAction.execute(request);
}
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/client/support/AbstractIndicesAdminClient.java b/modules/elasticsearch/src/main/java/org/elasticsearch/client/support/AbstractIndicesAdminClient.java
index e028ae0c335..0f2a85e4f22 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/client/support/AbstractIndicesAdminClient.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/client/support/AbstractIndicesAdminClient.java
@@ -21,12 +21,14 @@ package org.elasticsearch.client.support;
import org.elasticsearch.client.action.admin.indices.alias.IndicesAliasesRequestBuilder;
import org.elasticsearch.client.action.admin.indices.cache.clear.ClearIndicesCacheRequestBuilder;
+import org.elasticsearch.client.action.admin.indices.close.CloseIndexRequestBuilder;
import org.elasticsearch.client.action.admin.indices.create.CreateIndexRequestBuilder;
import org.elasticsearch.client.action.admin.indices.delete.DeleteIndexRequestBuilder;
import org.elasticsearch.client.action.admin.indices.flush.FlushRequestBuilder;
import org.elasticsearch.client.action.admin.indices.gateway.snapshot.GatewaySnapshotRequestBuilder;
import org.elasticsearch.client.action.admin.indices.mapping.delete.DeleteMappingRequestBuilder;
import org.elasticsearch.client.action.admin.indices.mapping.put.PutMappingRequestBuilder;
+import org.elasticsearch.client.action.admin.indices.open.OpenIndexRequestBuilder;
import org.elasticsearch.client.action.admin.indices.optimize.OptimizeRequestBuilder;
import org.elasticsearch.client.action.admin.indices.refresh.RefreshRequestBuilder;
import org.elasticsearch.client.action.admin.indices.settings.UpdateSettingsRequestBuilder;
@@ -54,6 +56,14 @@ public abstract class AbstractIndicesAdminClient implements InternalIndicesAdmin
return new DeleteIndexRequestBuilder(this, index);
}
+ @Override public CloseIndexRequestBuilder prepareClose(String index) {
+ return new CloseIndexRequestBuilder(this, index);
+ }
+
+ @Override public OpenIndexRequestBuilder prepareOpen(String index) {
+ return new OpenIndexRequestBuilder(this, index);
+ }
+
@Override public FlushRequestBuilder prepareFlush(String... indices) {
return new FlushRequestBuilder(this).setIndices(indices);
}
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/client/transport/action/ClientTransportActionModule.java b/modules/elasticsearch/src/main/java/org/elasticsearch/client/transport/action/ClientTransportActionModule.java
index bdc0f9704f3..d907e475b37 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/client/transport/action/ClientTransportActionModule.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/client/transport/action/ClientTransportActionModule.java
@@ -30,12 +30,14 @@ import org.elasticsearch.client.transport.action.admin.cluster.ping.single.Clien
import org.elasticsearch.client.transport.action.admin.cluster.state.ClientTransportClusterStateAction;
import org.elasticsearch.client.transport.action.admin.indices.alias.ClientTransportIndicesAliasesAction;
import org.elasticsearch.client.transport.action.admin.indices.cache.clear.ClientTransportClearIndicesCacheAction;
+import org.elasticsearch.client.transport.action.admin.indices.close.ClientTransportCloseIndexAction;
import org.elasticsearch.client.transport.action.admin.indices.create.ClientTransportCreateIndexAction;
import org.elasticsearch.client.transport.action.admin.indices.delete.ClientTransportDeleteIndexAction;
import org.elasticsearch.client.transport.action.admin.indices.flush.ClientTransportFlushAction;
import org.elasticsearch.client.transport.action.admin.indices.gateway.snapshot.ClientTransportGatewaySnapshotAction;
import org.elasticsearch.client.transport.action.admin.indices.mapping.delete.ClientTransportDeleteMappingAction;
import org.elasticsearch.client.transport.action.admin.indices.mapping.put.ClientTransportPutMappingAction;
+import org.elasticsearch.client.transport.action.admin.indices.open.ClientTransportOpenIndexAction;
import org.elasticsearch.client.transport.action.admin.indices.optimize.ClientTransportOptimizeAction;
import org.elasticsearch.client.transport.action.admin.indices.refresh.ClientTransportRefreshAction;
import org.elasticsearch.client.transport.action.admin.indices.settings.ClientTransportUpdateSettingsAction;
@@ -71,6 +73,8 @@ public class ClientTransportActionModule extends AbstractModule {
bind(ClientTransportOptimizeAction.class).asEagerSingleton();
bind(ClientTransportCreateIndexAction.class).asEagerSingleton();
bind(ClientTransportDeleteIndexAction.class).asEagerSingleton();
+ bind(ClientTransportCloseIndexAction.class).asEagerSingleton();
+ bind(ClientTransportOpenIndexAction.class).asEagerSingleton();
bind(ClientTransportPutMappingAction.class).asEagerSingleton();
bind(ClientTransportDeleteMappingAction.class).asEagerSingleton();
bind(ClientTransportGatewaySnapshotAction.class).asEagerSingleton();
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/client/transport/action/admin/indices/close/ClientTransportCloseIndexAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/client/transport/action/admin/indices/close/ClientTransportCloseIndexAction.java
new file mode 100644
index 00000000000..467bc3d7d0f
--- /dev/null
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/client/transport/action/admin/indices/close/ClientTransportCloseIndexAction.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to Elastic Search and Shay Banon under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. Elastic Search licenses this
+ * file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.elasticsearch.client.transport.action.admin.indices.close;
+
+import org.elasticsearch.action.TransportActions;
+import org.elasticsearch.action.admin.indices.close.CloseIndexRequest;
+import org.elasticsearch.action.admin.indices.close.CloseIndexResponse;
+import org.elasticsearch.client.transport.action.support.BaseClientTransportAction;
+import org.elasticsearch.common.inject.Inject;
+import org.elasticsearch.common.settings.Settings;
+import org.elasticsearch.transport.TransportService;
+
+/**
+ * @author kimchy (Shay Banon)
+ */
+public class ClientTransportCloseIndexAction extends BaseClientTransportAction {
+
+ @Inject public ClientTransportCloseIndexAction(Settings settings, TransportService transportService) {
+ super(settings, transportService, CloseIndexResponse.class);
+ }
+
+ @Override protected String action() {
+ return TransportActions.Admin.Indices.CLOSE;
+ }
+}
\ No newline at end of file
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/client/transport/action/admin/indices/open/ClientTransportOpenIndexAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/client/transport/action/admin/indices/open/ClientTransportOpenIndexAction.java
new file mode 100644
index 00000000000..4fd7eab1356
--- /dev/null
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/client/transport/action/admin/indices/open/ClientTransportOpenIndexAction.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to Elastic Search and Shay Banon under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. Elastic Search licenses this
+ * file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.elasticsearch.client.transport.action.admin.indices.open;
+
+import org.elasticsearch.action.TransportActions;
+import org.elasticsearch.action.admin.indices.open.OpenIndexRequest;
+import org.elasticsearch.action.admin.indices.open.OpenIndexResponse;
+import org.elasticsearch.client.transport.action.support.BaseClientTransportAction;
+import org.elasticsearch.common.inject.Inject;
+import org.elasticsearch.common.settings.Settings;
+import org.elasticsearch.transport.TransportService;
+
+/**
+ * @author kimchy (Shay Banon)
+ */
+public class ClientTransportOpenIndexAction extends BaseClientTransportAction {
+
+ @Inject public ClientTransportOpenIndexAction(Settings settings, TransportService transportService) {
+ super(settings, transportService, OpenIndexResponse.class);
+ }
+
+ @Override protected String action() {
+ return TransportActions.Admin.Indices.OPEN;
+ }
+}
\ No newline at end of file
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/client/transport/support/InternalTransportIndicesAdminClient.java b/modules/elasticsearch/src/main/java/org/elasticsearch/client/transport/support/InternalTransportIndicesAdminClient.java
index 31cdc314009..e3c175a419b 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/client/transport/support/InternalTransportIndicesAdminClient.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/client/transport/support/InternalTransportIndicesAdminClient.java
@@ -26,6 +26,8 @@ import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest;
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesResponse;
import org.elasticsearch.action.admin.indices.cache.clear.ClearIndicesCacheRequest;
import org.elasticsearch.action.admin.indices.cache.clear.ClearIndicesCacheResponse;
+import org.elasticsearch.action.admin.indices.close.CloseIndexRequest;
+import org.elasticsearch.action.admin.indices.close.CloseIndexResponse;
import org.elasticsearch.action.admin.indices.create.CreateIndexRequest;
import org.elasticsearch.action.admin.indices.create.CreateIndexResponse;
import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest;
@@ -38,6 +40,8 @@ import org.elasticsearch.action.admin.indices.mapping.delete.DeleteMappingReques
import org.elasticsearch.action.admin.indices.mapping.delete.DeleteMappingResponse;
import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest;
import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse;
+import org.elasticsearch.action.admin.indices.open.OpenIndexRequest;
+import org.elasticsearch.action.admin.indices.open.OpenIndexResponse;
import org.elasticsearch.action.admin.indices.optimize.OptimizeRequest;
import org.elasticsearch.action.admin.indices.optimize.OptimizeResponse;
import org.elasticsearch.action.admin.indices.refresh.RefreshRequest;
@@ -51,12 +55,14 @@ import org.elasticsearch.client.support.AbstractIndicesAdminClient;
import org.elasticsearch.client.transport.TransportClientNodesService;
import org.elasticsearch.client.transport.action.admin.indices.alias.ClientTransportIndicesAliasesAction;
import org.elasticsearch.client.transport.action.admin.indices.cache.clear.ClientTransportClearIndicesCacheAction;
+import org.elasticsearch.client.transport.action.admin.indices.close.ClientTransportCloseIndexAction;
import org.elasticsearch.client.transport.action.admin.indices.create.ClientTransportCreateIndexAction;
import org.elasticsearch.client.transport.action.admin.indices.delete.ClientTransportDeleteIndexAction;
import org.elasticsearch.client.transport.action.admin.indices.flush.ClientTransportFlushAction;
import org.elasticsearch.client.transport.action.admin.indices.gateway.snapshot.ClientTransportGatewaySnapshotAction;
import org.elasticsearch.client.transport.action.admin.indices.mapping.delete.ClientTransportDeleteMappingAction;
import org.elasticsearch.client.transport.action.admin.indices.mapping.put.ClientTransportPutMappingAction;
+import org.elasticsearch.client.transport.action.admin.indices.open.ClientTransportOpenIndexAction;
import org.elasticsearch.client.transport.action.admin.indices.optimize.ClientTransportOptimizeAction;
import org.elasticsearch.client.transport.action.admin.indices.refresh.ClientTransportRefreshAction;
import org.elasticsearch.client.transport.action.admin.indices.settings.ClientTransportUpdateSettingsAction;
@@ -81,6 +87,10 @@ public class InternalTransportIndicesAdminClient extends AbstractIndicesAdminCli
private final ClientTransportDeleteIndexAction deleteIndexAction;
+ private final ClientTransportCloseIndexAction closeIndexAction;
+
+ private final ClientTransportOpenIndexAction openIndexAction;
+
private final ClientTransportRefreshAction refreshAction;
private final ClientTransportFlushAction flushAction;
@@ -102,6 +112,7 @@ public class InternalTransportIndicesAdminClient extends AbstractIndicesAdminCli
@Inject public InternalTransportIndicesAdminClient(Settings settings, TransportClientNodesService nodesService, ThreadPool threadPool,
ClientTransportIndicesStatusAction indicesStatusAction,
ClientTransportCreateIndexAction createIndexAction, ClientTransportDeleteIndexAction deleteIndexAction,
+ ClientTransportCloseIndexAction closeIndexAction, ClientTransportOpenIndexAction openIndexAction,
ClientTransportRefreshAction refreshAction, ClientTransportFlushAction flushAction, ClientTransportOptimizeAction optimizeAction,
ClientTransportPutMappingAction putMappingAction, ClientTransportDeleteMappingAction deleteMappingAction, ClientTransportGatewaySnapshotAction gatewaySnapshotAction,
ClientTransportIndicesAliasesAction indicesAliasesAction, ClientTransportClearIndicesCacheAction clearIndicesCacheAction,
@@ -111,6 +122,8 @@ public class InternalTransportIndicesAdminClient extends AbstractIndicesAdminCli
this.indicesStatusAction = indicesStatusAction;
this.createIndexAction = createIndexAction;
this.deleteIndexAction = deleteIndexAction;
+ this.closeIndexAction = closeIndexAction;
+ this.openIndexAction = openIndexAction;
this.refreshAction = refreshAction;
this.flushAction = flushAction;
this.optimizeAction = optimizeAction;
@@ -177,6 +190,40 @@ public class InternalTransportIndicesAdminClient extends AbstractIndicesAdminCli
});
}
+ @Override public ActionFuture close(final CloseIndexRequest request) {
+ return nodesService.execute(new TransportClientNodesService.NodeCallback>() {
+ @Override public ActionFuture doWithNode(DiscoveryNode node) throws ElasticSearchException {
+ return closeIndexAction.execute(node, request);
+ }
+ });
+ }
+
+ @Override public void close(final CloseIndexRequest request, final ActionListener listener) {
+ nodesService.execute(new TransportClientNodesService.NodeCallback