Unified default ack timeout to 30 seconds

Increased also default publish state timeout to 30 seconds (from 5 seconds) and introduced constant for it.
Introduced AcknowledgedRequest.DEFAULT_ACK_TIMEOUT constant.
Removed misleading default values coming from the REST layer.
Removed (in a bw compatible manner) the timeout support in put/delete index template as the timeout parameter was ignored.

Closes #4395
This commit is contained in:
Luca Cavanna 2013-12-10 10:39:55 +01:00
parent f9ff733eb8
commit 037bf6a85f
16 changed files with 38 additions and 121 deletions

View File

@ -25,6 +25,7 @@ import org.elasticsearch.ElasticSearchIllegalArgumentException;
import org.elasticsearch.ElasticSearchParseException; import org.elasticsearch.ElasticSearchParseException;
import org.elasticsearch.action.ActionRequestValidationException; import org.elasticsearch.action.ActionRequestValidationException;
import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest; import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest;
import org.elasticsearch.action.support.master.AcknowledgedRequest;
import org.elasticsearch.action.support.master.MasterNodeOperationRequest; import org.elasticsearch.action.support.master.MasterNodeOperationRequest;
import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.cluster.metadata.IndexMetaData;
import org.elasticsearch.common.bytes.BytesArray; import org.elasticsearch.common.bytes.BytesArray;
@ -41,7 +42,6 @@ import org.elasticsearch.common.xcontent.XContentType;
import java.io.IOException; import java.io.IOException;
import java.util.Map; import java.util.Map;
import java.util.concurrent.TimeUnit;
import static com.google.common.collect.Maps.newHashMap; import static com.google.common.collect.Maps.newHashMap;
import static org.elasticsearch.action.ValidateActions.addValidationError; import static org.elasticsearch.action.ValidateActions.addValidationError;
@ -71,7 +71,7 @@ public class CreateIndexRequest extends MasterNodeOperationRequest<CreateIndexRe
private Map<String, IndexMetaData.Custom> customs = newHashMap(); private Map<String, IndexMetaData.Custom> customs = newHashMap();
private TimeValue timeout = new TimeValue(10, TimeUnit.SECONDS); private TimeValue timeout = AcknowledgedRequest.DEFAULT_ACK_TIMEOUT;
CreateIndexRequest() { CreateIndexRequest() {
} }
@ -342,7 +342,7 @@ public class CreateIndexRequest extends MasterNodeOperationRequest<CreateIndexRe
* Timeout to wait for the index creation to be acknowledged by current cluster nodes. Defaults * Timeout to wait for the index creation to be acknowledged by current cluster nodes. Defaults
* to <tt>10s</tt>. * to <tt>10s</tt>.
*/ */
TimeValue timeout() { public TimeValue timeout() {
return timeout; return timeout;
} }

View File

@ -20,6 +20,7 @@
package org.elasticsearch.action.admin.indices.delete; package org.elasticsearch.action.admin.indices.delete;
import org.elasticsearch.action.ActionRequestValidationException; import org.elasticsearch.action.ActionRequestValidationException;
import org.elasticsearch.action.support.master.AcknowledgedRequest;
import org.elasticsearch.action.support.master.MasterNodeOperationRequest; import org.elasticsearch.action.support.master.MasterNodeOperationRequest;
import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.StreamOutput;
@ -29,7 +30,6 @@ import java.io.IOException;
import static org.elasticsearch.action.ValidateActions.addValidationError; import static org.elasticsearch.action.ValidateActions.addValidationError;
import static org.elasticsearch.common.unit.TimeValue.readTimeValue; import static org.elasticsearch.common.unit.TimeValue.readTimeValue;
import static org.elasticsearch.common.unit.TimeValue.timeValueSeconds;
/** /**
* A request to delete an index. Best created with {@link org.elasticsearch.client.Requests#deleteIndexRequest(String)}. * A request to delete an index. Best created with {@link org.elasticsearch.client.Requests#deleteIndexRequest(String)}.
@ -38,7 +38,7 @@ public class DeleteIndexRequest extends MasterNodeOperationRequest<DeleteIndexRe
private String[] indices; private String[] indices;
private TimeValue timeout = timeValueSeconds(60); private TimeValue timeout = AcknowledgedRequest.DEFAULT_ACK_TIMEOUT;
DeleteIndexRequest() { DeleteIndexRequest() {
} }
@ -79,7 +79,7 @@ public class DeleteIndexRequest extends MasterNodeOperationRequest<DeleteIndexRe
* Timeout to wait for the index deletion to be acknowledged by current cluster nodes. Defaults * Timeout to wait for the index deletion to be acknowledged by current cluster nodes. Defaults
* to <tt>10s</tt>. * to <tt>10s</tt>.
*/ */
TimeValue timeout() { public TimeValue timeout() {
return timeout; return timeout;
} }

View File

@ -19,17 +19,17 @@
package org.elasticsearch.action.admin.indices.template.delete; package org.elasticsearch.action.admin.indices.template.delete;
import org.elasticsearch.Version;
import org.elasticsearch.action.ActionRequestValidationException; import org.elasticsearch.action.ActionRequestValidationException;
import org.elasticsearch.action.support.master.AcknowledgedRequest;
import org.elasticsearch.action.support.master.MasterNodeOperationRequest; import org.elasticsearch.action.support.master.MasterNodeOperationRequest;
import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.unit.TimeValue;
import java.io.IOException; import java.io.IOException;
import static org.elasticsearch.action.ValidateActions.addValidationError; import static org.elasticsearch.action.ValidateActions.addValidationError;
import static org.elasticsearch.common.unit.TimeValue.readTimeValue; import static org.elasticsearch.common.unit.TimeValue.readTimeValue;
import static org.elasticsearch.common.unit.TimeValue.timeValueSeconds;
/** /**
* A request to delete an index template. * A request to delete an index template.
@ -38,8 +38,6 @@ public class DeleteIndexTemplateRequest extends MasterNodeOperationRequest<Delet
private String name; private String name;
private TimeValue timeout = timeValueSeconds(10);
DeleteIndexTemplateRequest() { DeleteIndexTemplateRequest() {
} }
@ -66,42 +64,23 @@ public class DeleteIndexTemplateRequest extends MasterNodeOperationRequest<Delet
return name; return name;
} }
/**
* Timeout to wait for the index deletion to be acknowledged by current cluster nodes. Defaults
* to <tt>10s</tt>.
*/
TimeValue timeout() {
return timeout;
}
/**
* Timeout to wait for the index template deletion to be acknowledged by current cluster nodes. Defaults
* to <tt>10s</tt>.
*/
public DeleteIndexTemplateRequest timeout(TimeValue timeout) {
this.timeout = timeout;
return this;
}
/**
* Timeout to wait for the index template deletion to be acknowledged by current cluster nodes. Defaults
* to <tt>10s</tt>.
*/
public DeleteIndexTemplateRequest timeout(String timeout) {
return timeout(TimeValue.parseTimeValue(timeout, null));
}
@Override @Override
public void readFrom(StreamInput in) throws IOException { public void readFrom(StreamInput in) throws IOException {
super.readFrom(in); super.readFrom(in);
name = in.readString(); name = in.readString();
timeout = readTimeValue(in); //timeout was ignored till 0.90.7, removed afterwards
if (in.getVersion().onOrBefore(Version.V_0_90_7)) {
readTimeValue(in);
}
} }
@Override @Override
public void writeTo(StreamOutput out) throws IOException { public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out); super.writeTo(out);
out.writeString(name); out.writeString(name);
timeout.writeTo(out); //timeout was ignored till 0.90.7, removed afterwards
if (out.getVersion().onOrBefore(Version.V_0_90_7)) {
AcknowledgedRequest.DEFAULT_ACK_TIMEOUT.writeTo(out);
}
} }
} }

View File

@ -23,7 +23,6 @@ import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.master.MasterNodeOperationRequestBuilder; import org.elasticsearch.action.support.master.MasterNodeOperationRequestBuilder;
import org.elasticsearch.client.IndicesAdminClient; import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.client.internal.InternalIndicesAdminClient; import org.elasticsearch.client.internal.InternalIndicesAdminClient;
import org.elasticsearch.common.unit.TimeValue;
/** /**
* *
@ -38,24 +37,6 @@ public class DeleteIndexTemplateRequestBuilder extends MasterNodeOperationReques
super((InternalIndicesAdminClient) indicesClient, new DeleteIndexTemplateRequest(name)); super((InternalIndicesAdminClient) indicesClient, new DeleteIndexTemplateRequest(name));
} }
/**
* Timeout to wait for the index deletion to be acknowledged by current cluster nodes. Defaults
* to <tt>10s</tt>.
*/
public DeleteIndexTemplateRequestBuilder setTimeout(TimeValue timeout) {
request.timeout(timeout);
return this;
}
/**
* Timeout to wait for the index deletion to be acknowledged by current cluster nodes. Defaults
* to <tt>10s</tt>.
*/
public DeleteIndexTemplateRequestBuilder setTimeout(String timeout) {
request.timeout(timeout);
return this;
}
@Override @Override
protected void doExecute(ActionListener<DeleteIndexTemplateResponse> listener) { protected void doExecute(ActionListener<DeleteIndexTemplateResponse> listener) {
((IndicesAdminClient) client).deleteTemplate(request, listener); ((IndicesAdminClient) client).deleteTemplate(request, listener);

View File

@ -22,7 +22,9 @@ package org.elasticsearch.action.admin.indices.template.put;
import org.elasticsearch.ElasticSearchGenerationException; import org.elasticsearch.ElasticSearchGenerationException;
import org.elasticsearch.ElasticSearchIllegalArgumentException; import org.elasticsearch.ElasticSearchIllegalArgumentException;
import org.elasticsearch.ElasticSearchParseException; import org.elasticsearch.ElasticSearchParseException;
import org.elasticsearch.Version;
import org.elasticsearch.action.ActionRequestValidationException; import org.elasticsearch.action.ActionRequestValidationException;
import org.elasticsearch.action.support.master.AcknowledgedRequest;
import org.elasticsearch.action.support.master.MasterNodeOperationRequest; import org.elasticsearch.action.support.master.MasterNodeOperationRequest;
import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.cluster.metadata.IndexMetaData;
import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.common.bytes.BytesReference;
@ -31,7 +33,6 @@ import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.common.xcontent.XContentType;
@ -39,7 +40,6 @@ import org.elasticsearch.common.xcontent.support.XContentMapValues;
import java.io.IOException; import java.io.IOException;
import java.util.Map; import java.util.Map;
import java.util.concurrent.TimeUnit;
import static com.google.common.collect.Maps.newHashMap; import static com.google.common.collect.Maps.newHashMap;
import static org.elasticsearch.action.ValidateActions.addValidationError; import static org.elasticsearch.action.ValidateActions.addValidationError;
@ -69,8 +69,6 @@ public class PutIndexTemplateRequest extends MasterNodeOperationRequest<PutIndex
private Map<String, IndexMetaData.Custom> customs = newHashMap(); private Map<String, IndexMetaData.Custom> customs = newHashMap();
private TimeValue timeout = new TimeValue(10, TimeUnit.SECONDS);
PutIndexTemplateRequest() { PutIndexTemplateRequest() {
} }
@ -342,31 +340,6 @@ public class PutIndexTemplateRequest extends MasterNodeOperationRequest<PutIndex
return this.customs; return this.customs;
} }
/**
* Timeout to wait till the put mapping gets acknowledged of all current cluster nodes. Defaults to
* <tt>10s</tt>.
*/
TimeValue timeout() {
return timeout;
}
/**
* Timeout to wait till the put mapping gets acknowledged of all current cluster nodes. Defaults to
* <tt>10s</tt>.
*/
public PutIndexTemplateRequest timeout(TimeValue timeout) {
this.timeout = timeout;
return this;
}
/**
* Timeout to wait till the put mapping gets acknowledged of all current cluster nodes. Defaults to
* <tt>10s</tt>.
*/
public PutIndexTemplateRequest timeout(String timeout) {
return timeout(TimeValue.parseTimeValue(timeout, null));
}
@Override @Override
public void readFrom(StreamInput in) throws IOException { public void readFrom(StreamInput in) throws IOException {
super.readFrom(in); super.readFrom(in);
@ -376,7 +349,10 @@ public class PutIndexTemplateRequest extends MasterNodeOperationRequest<PutIndex
order = in.readInt(); order = in.readInt();
create = in.readBoolean(); create = in.readBoolean();
settings = readSettingsFromStream(in); settings = readSettingsFromStream(in);
timeout = readTimeValue(in); //timeout was ignored till 0.90.7, removed afterwards
if (in.getVersion().onOrBefore(Version.V_0_90_7)) {
readTimeValue(in);
}
int size = in.readVInt(); int size = in.readVInt();
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
mappings.put(in.readString(), in.readString()); mappings.put(in.readString(), in.readString());
@ -398,7 +374,10 @@ public class PutIndexTemplateRequest extends MasterNodeOperationRequest<PutIndex
out.writeInt(order); out.writeInt(order);
out.writeBoolean(create); out.writeBoolean(create);
writeSettingsToStream(settings, out); writeSettingsToStream(settings, out);
timeout.writeTo(out); //timeout was ignored till 0.90.7, removed afterwards
if (out.getVersion().onOrBefore(Version.V_0_90_7)) {
AcknowledgedRequest.DEFAULT_ACK_TIMEOUT.writeTo(out);
}
out.writeVInt(mappings.size()); out.writeVInt(mappings.size());
for (Map.Entry<String, String> entry : mappings.entrySet()) { for (Map.Entry<String, String> entry : mappings.entrySet()) {
out.writeString(entry.getKey()); out.writeString(entry.getKey());

View File

@ -25,7 +25,6 @@ import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.client.internal.InternalIndicesAdminClient; import org.elasticsearch.client.internal.InternalIndicesAdminClient;
import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentBuilder;
import java.util.Map; import java.util.Map;
@ -189,24 +188,6 @@ public class PutIndexTemplateRequestBuilder extends MasterNodeOperationRequestBu
return this; return this;
} }
/**
* Timeout to wait for the index creation to be acknowledged by current cluster nodes. Defaults
* to <tt>10s</tt>.
*/
public PutIndexTemplateRequestBuilder setTimeout(TimeValue timeout) {
request.timeout(timeout);
return this;
}
/**
* Timeout to wait for the index creation to be acknowledged by current cluster nodes. Defaults
* to <tt>10s</tt>.
*/
public PutIndexTemplateRequestBuilder setTimeout(String timeout) {
request.timeout(timeout);
return this;
}
@Override @Override
protected void doExecute(ActionListener<PutIndexTemplateResponse> listener) { protected void doExecute(ActionListener<PutIndexTemplateResponse> listener) {
((IndicesAdminClient) client).putTemplate(request, listener); ((IndicesAdminClient) client).putTemplate(request, listener);

View File

@ -34,7 +34,9 @@ import static org.elasticsearch.common.unit.TimeValue.timeValueSeconds;
*/ */
public abstract class AcknowledgedRequest<T extends MasterNodeOperationRequest> extends MasterNodeOperationRequest<T> { public abstract class AcknowledgedRequest<T extends MasterNodeOperationRequest> extends MasterNodeOperationRequest<T> {
protected TimeValue timeout = timeValueSeconds(10); public static final TimeValue DEFAULT_ACK_TIMEOUT = timeValueSeconds(30);
protected TimeValue timeout = DEFAULT_ACK_TIMEOUT;
protected AcknowledgedRequest() { protected AcknowledgedRequest() {
} }

View File

@ -26,6 +26,7 @@ import org.elasticsearch.cluster.node.DiscoveryNode;
import org.elasticsearch.cluster.routing.allocation.AllocationService; import org.elasticsearch.cluster.routing.allocation.AllocationService;
import org.elasticsearch.common.Nullable; import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.component.LifecycleComponent; import org.elasticsearch.common.component.LifecycleComponent;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.node.service.NodeService; import org.elasticsearch.node.service.NodeService;
import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.RestStatus;
@ -38,6 +39,8 @@ public interface Discovery extends LifecycleComponent<Discovery> {
final ClusterBlock NO_MASTER_BLOCK = new ClusterBlock(2, "no master", true, true, RestStatus.SERVICE_UNAVAILABLE, ClusterBlockLevel.ALL); final ClusterBlock NO_MASTER_BLOCK = new ClusterBlock(2, "no master", true, true, RestStatus.SERVICE_UNAVAILABLE, ClusterBlockLevel.ALL);
public static final TimeValue DEFAULT_PUBLISH_TIMEOUT = TimeValue.timeValueSeconds(30);
DiscoveryNode localNode(); DiscoveryNode localNode();
void addListener(InitialStateDiscoveryListener listener); void addListener(InitialStateDiscoveryListener listener);

View File

@ -90,7 +90,7 @@ public class LocalDiscovery extends AbstractLifecycleComponent<Discovery> implem
this.discoveryNodeService = discoveryNodeService; this.discoveryNodeService = discoveryNodeService;
this.version = version; this.version = version;
this.publishTimeout = settings.getAsTime("discovery.zen.publish_timeout", TimeValue.timeValueSeconds(5)); this.publishTimeout = settings.getAsTime("discovery.zen.publish_timeout", DEFAULT_PUBLISH_TIMEOUT);
} }
@Override @Override

View File

@ -69,7 +69,7 @@ public class PublishClusterStateAction extends AbstractComponent {
this.nodesProvider = nodesProvider; this.nodesProvider = nodesProvider;
this.listener = listener; this.listener = listener;
this.publishTimeout = settings.getAsTime("discovery.zen.publish_timeout", TimeValue.timeValueSeconds(5)); this.publishTimeout = settings.getAsTime("discovery.zen.publish_timeout", Discovery.DEFAULT_PUBLISH_TIMEOUT);
transportService.registerHandler(PublishClusterStateRequestHandler.ACTION, new PublishClusterStateRequestHandler()); transportService.registerHandler(PublishClusterStateRequestHandler.ACTION, new PublishClusterStateRequestHandler());
} }

View File

@ -31,7 +31,6 @@ import org.elasticsearch.rest.action.support.RestXContentBuilder;
import java.io.IOException; import java.io.IOException;
import static org.elasticsearch.common.unit.TimeValue.timeValueSeconds;
import static org.elasticsearch.rest.RestRequest.Method.DELETE; import static org.elasticsearch.rest.RestRequest.Method.DELETE;
import static org.elasticsearch.rest.RestStatus.OK; import static org.elasticsearch.rest.RestStatus.OK;
@ -50,7 +49,7 @@ public class RestIndexDeleteAliasesAction extends BaseRestHandler {
final String index = request.param("index"); final String index = request.param("index");
String alias = request.param("name"); String alias = request.param("name");
IndicesAliasesRequest indicesAliasesRequest = new IndicesAliasesRequest(); IndicesAliasesRequest indicesAliasesRequest = new IndicesAliasesRequest();
indicesAliasesRequest.timeout(request.paramAsTime("timeout", timeValueSeconds(10))); indicesAliasesRequest.timeout(request.paramAsTime("timeout", indicesAliasesRequest.timeout()));
indicesAliasesRequest.removeAlias(index, alias); indicesAliasesRequest.removeAlias(index, alias);
indicesAliasesRequest.masterNodeTimeout(request.paramAsTime("master_timeout", indicesAliasesRequest.masterNodeTimeout())); indicesAliasesRequest.masterNodeTimeout(request.paramAsTime("master_timeout", indicesAliasesRequest.masterNodeTimeout()));

View File

@ -36,7 +36,6 @@ import org.elasticsearch.rest.action.support.RestXContentBuilder;
import java.io.IOException; import java.io.IOException;
import java.util.Map; import java.util.Map;
import static org.elasticsearch.common.unit.TimeValue.timeValueSeconds;
import static org.elasticsearch.rest.RestRequest.Method.PUT; import static org.elasticsearch.rest.RestRequest.Method.PUT;
import static org.elasticsearch.rest.RestStatus.OK; import static org.elasticsearch.rest.RestStatus.OK;
@ -107,7 +106,7 @@ public class RestIndexPutAliasAction extends BaseRestHandler {
} }
IndicesAliasesRequest indicesAliasesRequest = new IndicesAliasesRequest(); IndicesAliasesRequest indicesAliasesRequest = new IndicesAliasesRequest();
indicesAliasesRequest.timeout(request.paramAsTime("timeout", timeValueSeconds(10))); indicesAliasesRequest.timeout(request.paramAsTime("timeout", indicesAliasesRequest.timeout()));
AliasAction aliasAction = new AliasAction(AliasAction.Type.ADD, index, alias); AliasAction aliasAction = new AliasAction(AliasAction.Type.ADD, index, alias);
indicesAliasesRequest.addAliasAction(aliasAction); indicesAliasesRequest.addAliasAction(aliasAction);
indicesAliasesRequest.masterNodeTimeout(request.paramAsTime("master_timeout", indicesAliasesRequest.masterNodeTimeout())); indicesAliasesRequest.masterNodeTimeout(request.paramAsTime("master_timeout", indicesAliasesRequest.masterNodeTimeout()));

View File

@ -31,7 +31,6 @@ import org.elasticsearch.rest.action.support.RestXContentBuilder;
import java.io.IOException; import java.io.IOException;
import static org.elasticsearch.common.unit.TimeValue.timeValueSeconds;
import static org.elasticsearch.rest.RestStatus.OK; import static org.elasticsearch.rest.RestStatus.OK;
/** /**
@ -64,7 +63,7 @@ public class RestCreateIndexAction extends BaseRestHandler {
} }
} }
createIndexRequest.timeout(request.paramAsTime("timeout", timeValueSeconds(10))); createIndexRequest.timeout(request.paramAsTime("timeout", createIndexRequest.timeout()));
createIndexRequest.masterNodeTimeout(request.paramAsTime("master_timeout", createIndexRequest.masterNodeTimeout())); createIndexRequest.masterNodeTimeout(request.paramAsTime("master_timeout", createIndexRequest.masterNodeTimeout()));
client.admin().indices().create(createIndexRequest, new ActionListener<CreateIndexResponse>() { client.admin().indices().create(createIndexRequest, new ActionListener<CreateIndexResponse>() {

View File

@ -33,7 +33,6 @@ import org.elasticsearch.rest.action.support.RestXContentBuilder;
import java.io.IOException; import java.io.IOException;
import static org.elasticsearch.common.unit.TimeValue.timeValueSeconds;
import static org.elasticsearch.rest.RestStatus.OK; import static org.elasticsearch.rest.RestStatus.OK;
/** /**
@ -52,7 +51,7 @@ public class RestDeleteIndexAction extends BaseRestHandler {
public void handleRequest(final RestRequest request, final RestChannel channel) { public void handleRequest(final RestRequest request, final RestChannel channel) {
DeleteIndexRequest deleteIndexRequest = new DeleteIndexRequest(Strings.splitStringByCommaToArray(request.param("index"))); DeleteIndexRequest deleteIndexRequest = new DeleteIndexRequest(Strings.splitStringByCommaToArray(request.param("index")));
deleteIndexRequest.listenerThreaded(false); deleteIndexRequest.listenerThreaded(false);
deleteIndexRequest.timeout(request.paramAsTime("timeout", timeValueSeconds(10))); deleteIndexRequest.timeout(request.paramAsTime("timeout", deleteIndexRequest.timeout()));
deleteIndexRequest.masterNodeTimeout(request.paramAsTime("master_timeout", deleteIndexRequest.masterNodeTimeout())); deleteIndexRequest.masterNodeTimeout(request.paramAsTime("master_timeout", deleteIndexRequest.masterNodeTimeout()));
client.admin().indices().delete(deleteIndexRequest, new ActionListener<DeleteIndexResponse>() { client.admin().indices().delete(deleteIndexRequest, new ActionListener<DeleteIndexResponse>() {
@Override @Override

View File

@ -32,7 +32,6 @@ import org.elasticsearch.rest.action.support.RestXContentBuilder;
import java.io.IOException; import java.io.IOException;
import static org.elasticsearch.common.unit.TimeValue.timeValueSeconds;
import static org.elasticsearch.rest.RestStatus.OK; import static org.elasticsearch.rest.RestStatus.OK;
/** /**
@ -50,7 +49,6 @@ public class RestDeleteIndexTemplateAction extends BaseRestHandler {
public void handleRequest(final RestRequest request, final RestChannel channel) { public void handleRequest(final RestRequest request, final RestChannel channel) {
DeleteIndexTemplateRequest deleteIndexTemplateRequest = new DeleteIndexTemplateRequest(request.param("name")); DeleteIndexTemplateRequest deleteIndexTemplateRequest = new DeleteIndexTemplateRequest(request.param("name"));
deleteIndexTemplateRequest.listenerThreaded(false); deleteIndexTemplateRequest.listenerThreaded(false);
deleteIndexTemplateRequest.timeout(request.paramAsTime("timeout", timeValueSeconds(10)));
deleteIndexTemplateRequest.masterNodeTimeout(request.paramAsTime("master_timeout", deleteIndexTemplateRequest.masterNodeTimeout())); deleteIndexTemplateRequest.masterNodeTimeout(request.paramAsTime("master_timeout", deleteIndexTemplateRequest.masterNodeTimeout()));
client.admin().indices().deleteTemplate(deleteIndexTemplateRequest, new ActionListener<DeleteIndexTemplateResponse>() { client.admin().indices().deleteTemplate(deleteIndexTemplateRequest, new ActionListener<DeleteIndexTemplateResponse>() {
@Override @Override

View File

@ -32,7 +32,6 @@ import org.elasticsearch.rest.action.support.RestXContentBuilder;
import java.io.IOException; import java.io.IOException;
import static org.elasticsearch.common.unit.TimeValue.timeValueSeconds;
import static org.elasticsearch.rest.RestStatus.OK; import static org.elasticsearch.rest.RestStatus.OK;
/** /**
@ -67,7 +66,6 @@ public class RestPutIndexTemplateAction extends BaseRestHandler {
try { try {
putRequest.create(request.paramAsBoolean("create", false)); putRequest.create(request.paramAsBoolean("create", false));
putRequest.cause(request.param("cause", "")); putRequest.cause(request.param("cause", ""));
putRequest.timeout(request.paramAsTime("timeout", timeValueSeconds(10)));
putRequest.source(request.content()); putRequest.source(request.content());
} catch (Exception e) { } catch (Exception e) {
try { try {