From a0d1b9b695beef84179e5b7391eaae3abffc3702 Mon Sep 17 00:00:00 2001 From: Shay Banon Date: Fri, 1 Jun 2012 11:25:55 +0200 Subject: [PATCH] explicitly set listener to false when applicable --- .../admin/cluster/state/ClusterStateRequest.java | 6 ++++++ .../action/search/TransportSearchScrollAction.java | 2 ++ .../admin/cluster/health/RestClusterHealthAction.java | 1 + .../cluster/reroute/RestClusterRerouteAction.java | 1 + .../cluster/settings/RestClusterGetSettingsAction.java | 1 + .../settings/RestClusterUpdateSettingsAction.java | 2 +- .../admin/cluster/state/RestClusterStateAction.java | 1 + .../indices/alias/RestGetIndicesAliasesAction.java | 2 ++ .../admin/indices/alias/RestIndicesAliasesAction.java | 1 + .../admin/indices/analyze/RestAnalyzeAction.java | 1 + .../cache/clear/RestClearIndicesCacheAction.java | 3 +-- .../admin/indices/close/RestCloseIndexAction.java | 1 + .../admin/indices/create/RestCreateIndexAction.java | 1 + .../admin/indices/delete/RestDeleteIndexAction.java | 1 + .../admin/indices/exists/RestIndicesExistsAction.java | 4 ++-- .../action/admin/indices/flush/RestFlushAction.java | 1 - .../mapping/delete/RestDeleteMappingAction.java | 1 + .../indices/mapping/get/RestGetMappingAction.java | 2 ++ .../indices/mapping/put/RestPutMappingAction.java | 1 + .../action/admin/indices/open/RestOpenIndexAction.java | 1 + .../admin/indices/optimize/RestOptimizeAction.java | 3 +-- .../admin/indices/refresh/RestRefreshAction.java | 1 - .../indices/segments/RestIndicesSegmentsAction.java | 1 - .../admin/indices/settings/RestGetSettingsAction.java | 1 + .../indices/settings/RestUpdateSettingsAction.java | 2 ++ .../admin/indices/stats/RestIndicesStatsAction.java | 10 ++++++++++ .../admin/indices/status/RestIndicesStatusAction.java | 1 - .../template/delete/RestDeleteIndexTemplateAction.java | 1 + .../template/get/RestGetIndexTemplateAction.java | 2 ++ .../template/put/RestPutIndexTemplateAction.java | 2 +- .../validate/query/RestValidateQueryAction.java | 3 +-- .../indices/warmer/delete/RestDeleteWarmerAction.java | 1 + .../admin/indices/warmer/get/RestGetWarmerAction.java | 2 ++ .../admin/indices/warmer/put/RestPutWarmerAction.java | 1 + .../elasticsearch/rest/action/bulk/RestBulkAction.java | 3 +-- .../rest/action/count/RestCountAction.java | 1 - .../rest/action/delete/RestDeleteAction.java | 8 ++++---- .../action/deletebyquery/RestDeleteByQueryAction.java | 1 - .../elasticsearch/rest/action/get/RestGetAction.java | 2 -- .../rest/action/index/RestIndexAction.java | 6 ++---- .../elasticsearch/rest/action/main/RestMainAction.java | 1 + .../rest/action/mlt/RestMoreLikeThisAction.java | 1 + .../rest/action/percolate/RestPercolateAction.java | 1 + .../rest/action/search/RestMultiSearchAction.java | 1 + .../rest/action/search/RestSearchScrollAction.java | 2 +- .../rest/action/update/RestUpdateAction.java | 3 +-- 46 files changed, 64 insertions(+), 31 deletions(-) diff --git a/src/main/java/org/elasticsearch/action/admin/cluster/state/ClusterStateRequest.java b/src/main/java/org/elasticsearch/action/admin/cluster/state/ClusterStateRequest.java index c4905db1ef7..7dabb7f4c3e 100644 --- a/src/main/java/org/elasticsearch/action/admin/cluster/state/ClusterStateRequest.java +++ b/src/main/java/org/elasticsearch/action/admin/cluster/state/ClusterStateRequest.java @@ -127,6 +127,12 @@ public class ClusterStateRequest extends MasterNodeOperationRequest { return this.local; } + @Override + public ClusterStateRequest listenerThreaded(boolean listenerThreaded) { + super.listenerThreaded(listenerThreaded); + return this; + } + @Override public void readFrom(StreamInput in) throws IOException { super.readFrom(in); diff --git a/src/main/java/org/elasticsearch/action/search/TransportSearchScrollAction.java b/src/main/java/org/elasticsearch/action/search/TransportSearchScrollAction.java index e8836ab52e8..ca4268df42d 100644 --- a/src/main/java/org/elasticsearch/action/search/TransportSearchScrollAction.java +++ b/src/main/java/org/elasticsearch/action/search/TransportSearchScrollAction.java @@ -87,6 +87,8 @@ public class TransportSearchScrollAction extends TransportAction() { @Override public void onResponse(SearchResponse result) { diff --git a/src/main/java/org/elasticsearch/rest/action/admin/cluster/health/RestClusterHealthAction.java b/src/main/java/org/elasticsearch/rest/action/admin/cluster/health/RestClusterHealthAction.java index 38042e6d4bd..a499eee0153 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/cluster/health/RestClusterHealthAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/cluster/health/RestClusterHealthAction.java @@ -51,6 +51,7 @@ public class RestClusterHealthAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { ClusterHealthRequest clusterHealthRequest = clusterHealthRequest(RestActions.splitIndices(request.param("index"))); + clusterHealthRequest.listenerThreaded(false); int level = 0; try { clusterHealthRequest.masterNodeTimeout(request.paramAsTime("master_timeout", clusterHealthRequest.masterNodeTimeout())); diff --git a/src/main/java/org/elasticsearch/rest/action/admin/cluster/reroute/RestClusterRerouteAction.java b/src/main/java/org/elasticsearch/rest/action/admin/cluster/reroute/RestClusterRerouteAction.java index 6851226a494..433213c075c 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/cluster/reroute/RestClusterRerouteAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/cluster/reroute/RestClusterRerouteAction.java @@ -45,6 +45,7 @@ public class RestClusterRerouteAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { final ClusterRerouteRequest clusterRerouteRequest = Requests.clusterRerouteRequest(); + clusterRerouteRequest.listenerThreaded(false); client.admin().cluster().reroute(clusterRerouteRequest, new ActionListener() { @Override public void onResponse(ClusterRerouteResponse response) { diff --git a/src/main/java/org/elasticsearch/rest/action/admin/cluster/settings/RestClusterGetSettingsAction.java b/src/main/java/org/elasticsearch/rest/action/admin/cluster/settings/RestClusterGetSettingsAction.java index 6980ec2767c..17400a5aa52 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/cluster/settings/RestClusterGetSettingsAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/cluster/settings/RestClusterGetSettingsAction.java @@ -46,6 +46,7 @@ public class RestClusterGetSettingsAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { ClusterStateRequest clusterStateRequest = Requests.clusterStateRequest() + .listenerThreaded(false) .filterRoutingTable(true) .filterNodes(true); client.admin().cluster().state(clusterStateRequest, new ActionListener() { diff --git a/src/main/java/org/elasticsearch/rest/action/admin/cluster/settings/RestClusterUpdateSettingsAction.java b/src/main/java/org/elasticsearch/rest/action/admin/cluster/settings/RestClusterUpdateSettingsAction.java index 16b1110e814..d77e9dcd24c 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/cluster/settings/RestClusterUpdateSettingsAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/cluster/settings/RestClusterUpdateSettingsAction.java @@ -46,7 +46,7 @@ public class RestClusterUpdateSettingsAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { final ClusterUpdateSettingsRequest clusterUpdateSettingsRequest = Requests.clusterUpdateSettingsRequest(); - + clusterUpdateSettingsRequest.listenerThreaded(false); try { XContentType xContentType = XContentFactory.xContentType(request.contentByteArray(), request.contentByteArrayOffset(), request.contentLength()); Map source = XContentFactory.xContent(xContentType) diff --git a/src/main/java/org/elasticsearch/rest/action/admin/cluster/state/RestClusterStateAction.java b/src/main/java/org/elasticsearch/rest/action/admin/cluster/state/RestClusterStateAction.java index 872d6ed5386..239770189fb 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/cluster/state/RestClusterStateAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/cluster/state/RestClusterStateAction.java @@ -72,6 +72,7 @@ public class RestClusterStateAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { final ClusterStateRequest clusterStateRequest = Requests.clusterStateRequest(); + clusterStateRequest.listenerThreaded(false); clusterStateRequest.masterNodeTimeout(request.paramAsTime("master_timeout", clusterStateRequest.masterNodeTimeout())); clusterStateRequest.filterNodes(request.paramAsBoolean("filter_nodes", clusterStateRequest.filterNodes())); clusterStateRequest.filterRoutingTable(request.paramAsBoolean("filter_routing_table", clusterStateRequest.filterRoutingTable())); diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/RestGetIndicesAliasesAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/RestGetIndicesAliasesAction.java index 8084b52ce8b..40b6e289c9b 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/RestGetIndicesAliasesAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/RestGetIndicesAliasesAction.java @@ -61,6 +61,8 @@ public class RestGetIndicesAliasesAction extends BaseRestHandler { .filterNodes(true) .filteredIndices(indices); + clusterStateRequest.listenerThreaded(false); + client.admin().cluster().state(clusterStateRequest, new ActionListener() { @Override public void onResponse(ClusterStateResponse response) { diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/RestIndicesAliasesAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/RestIndicesAliasesAction.java index 6d045f618ae..ff431e16cd5 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/RestIndicesAliasesAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/RestIndicesAliasesAction.java @@ -55,6 +55,7 @@ public class RestIndicesAliasesAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { IndicesAliasesRequest indicesAliasesRequest = new IndicesAliasesRequest(); + indicesAliasesRequest.listenerThreaded(false); try { // { // actions : [ diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/analyze/RestAnalyzeAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/analyze/RestAnalyzeAction.java index 49eb84808ef..396c7ac58ba 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/analyze/RestAnalyzeAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/analyze/RestAnalyzeAction.java @@ -66,6 +66,7 @@ public class RestAnalyzeAction extends BaseRestHandler { } AnalyzeRequest analyzeRequest = new AnalyzeRequest(request.param("index"), text); + analyzeRequest.listenerThreaded(false); analyzeRequest.preferLocal(request.paramAsBoolean("prefer_local", analyzeRequest.preferLocalShard())); analyzeRequest.analyzer(request.param("analyzer")); analyzeRequest.field(request.param("field")); diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/cache/clear/RestClearIndicesCacheAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/cache/clear/RestClearIndicesCacheAction.java index b51419d9a05..1eb647ba44e 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/cache/clear/RestClearIndicesCacheAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/cache/clear/RestClearIndicesCacheAction.java @@ -57,6 +57,7 @@ public class RestClearIndicesCacheAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { ClearIndicesCacheRequest clearIndicesCacheRequest = new ClearIndicesCacheRequest(RestActions.splitIndices(request.param("index"))); + clearIndicesCacheRequest.listenerThreaded(false); try { clearIndicesCacheRequest.filterCache(request.paramAsBoolean("filter", clearIndicesCacheRequest.filterCache())); clearIndicesCacheRequest.fieldDataCache(request.paramAsBoolean("field_data", clearIndicesCacheRequest.fieldDataCache())); @@ -64,8 +65,6 @@ public class RestClearIndicesCacheAction extends BaseRestHandler { clearIndicesCacheRequest.bloomCache(request.paramAsBoolean("bloom", clearIndicesCacheRequest.bloomCache())); clearIndicesCacheRequest.fields(request.paramAsStringArray("fields", clearIndicesCacheRequest.fields())); - // we just send back a response, no need to fork a listener - clearIndicesCacheRequest.listenerThreaded(false); BroadcastOperationThreading operationThreading = BroadcastOperationThreading.fromString(request.param("operationThreading"), BroadcastOperationThreading.SINGLE_THREAD); if (operationThreading == BroadcastOperationThreading.NO_THREADS) { // since we don't spawn, don't allow no_threads, but change it to a single thread diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/close/RestCloseIndexAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/close/RestCloseIndexAction.java index 8b475c7f807..54a58c0b5f8 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/close/RestCloseIndexAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/close/RestCloseIndexAction.java @@ -49,6 +49,7 @@ public class RestCloseIndexAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { CloseIndexRequest closeIndexRequest = new CloseIndexRequest(request.param("index")); + closeIndexRequest.listenerThreaded(false); closeIndexRequest.timeout(request.paramAsTime("timeout", timeValueSeconds(10))); client.admin().indices().close(closeIndexRequest, new ActionListener() { @Override diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/create/RestCreateIndexAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/create/RestCreateIndexAction.java index b43eaebdf4d..3969358956b 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/create/RestCreateIndexAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/create/RestCreateIndexAction.java @@ -50,6 +50,7 @@ public class RestCreateIndexAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { CreateIndexRequest createIndexRequest = new CreateIndexRequest(request.param("index")); + createIndexRequest.listenerThreaded(false); if (request.hasContent()) { try { createIndexRequest.source(request.contentByteArray(), request.contentByteArrayOffset(), request.contentLength()); diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/delete/RestDeleteIndexAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/delete/RestDeleteIndexAction.java index dc07306d7c5..4ca559ee045 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/delete/RestDeleteIndexAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/delete/RestDeleteIndexAction.java @@ -51,6 +51,7 @@ public class RestDeleteIndexAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { DeleteIndexRequest deleteIndexRequest = new DeleteIndexRequest(splitIndices(request.param("index"))); + deleteIndexRequest.listenerThreaded(false); deleteIndexRequest.timeout(request.paramAsTime("timeout", timeValueSeconds(10))); client.admin().indices().delete(deleteIndexRequest, new ActionListener() { @Override diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/exists/RestIndicesExistsAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/exists/RestIndicesExistsAction.java index f8cc00640cc..c46643c3421 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/exists/RestIndicesExistsAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/exists/RestIndicesExistsAction.java @@ -29,7 +29,8 @@ import org.elasticsearch.common.settings.SettingsFilter; import org.elasticsearch.rest.*; import static org.elasticsearch.rest.RestRequest.Method.HEAD; -import static org.elasticsearch.rest.RestStatus.*; +import static org.elasticsearch.rest.RestStatus.NOT_FOUND; +import static org.elasticsearch.rest.RestStatus.OK; import static org.elasticsearch.rest.action.support.RestActions.splitIndices; /** @@ -51,7 +52,6 @@ public class RestIndicesExistsAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { IndicesExistsRequest indicesExistsRequest = new IndicesExistsRequest(splitIndices(request.param("index"))); - // we just send back a response, no need to fork a listener indicesExistsRequest.listenerThreaded(false); client.admin().indices().exists(indicesExistsRequest, new ActionListener() { @Override diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/flush/RestFlushAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/flush/RestFlushAction.java index 0d731af5224..c7d75aba264 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/flush/RestFlushAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/flush/RestFlushAction.java @@ -56,7 +56,6 @@ public class RestFlushAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { FlushRequest flushRequest = new FlushRequest(RestActions.splitIndices(request.param("index"))); - // we just send back a response, no need to fork a listener flushRequest.listenerThreaded(false); BroadcastOperationThreading operationThreading = BroadcastOperationThreading.fromString(request.param("operationThreading"), BroadcastOperationThreading.SINGLE_THREAD); if (operationThreading == BroadcastOperationThreading.NO_THREADS) { diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/mapping/delete/RestDeleteMappingAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/mapping/delete/RestDeleteMappingAction.java index ab82b55b787..f9f37d244d7 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/mapping/delete/RestDeleteMappingAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/mapping/delete/RestDeleteMappingAction.java @@ -51,6 +51,7 @@ public class RestDeleteMappingAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { DeleteMappingRequest deleteMappingRequest = deleteMappingRequest(splitIndices(request.param("index"))); + deleteMappingRequest.listenerThreaded(false); deleteMappingRequest.type(request.param("type")); client.admin().indices().deleteMapping(deleteMappingRequest, new ActionListener() { @Override diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/mapping/get/RestGetMappingAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/mapping/get/RestGetMappingAction.java index af33f72e587..93f67d82acf 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/mapping/get/RestGetMappingAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/mapping/get/RestGetMappingAction.java @@ -69,6 +69,8 @@ public class RestGetMappingAction extends BaseRestHandler { .filterNodes(true) .filteredIndices(indices); + clusterStateRequest.listenerThreaded(false); + client.admin().cluster().state(clusterStateRequest, new ActionListener() { @Override public void onResponse(ClusterStateResponse response) { diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/mapping/put/RestPutMappingAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/mapping/put/RestPutMappingAction.java index d45c03adb33..9566e6e489b 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/mapping/put/RestPutMappingAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/mapping/put/RestPutMappingAction.java @@ -56,6 +56,7 @@ public class RestPutMappingAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { PutMappingRequest putMappingRequest = putMappingRequest(splitIndices(request.param("index"))); + putMappingRequest.listenerThreaded(false); putMappingRequest.type(request.param("type")); putMappingRequest.source(request.contentAsString()); putMappingRequest.timeout(request.paramAsTime("timeout", timeValueSeconds(10))); diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/open/RestOpenIndexAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/open/RestOpenIndexAction.java index 3cd38d2f7f5..85d9a421375 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/open/RestOpenIndexAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/open/RestOpenIndexAction.java @@ -49,6 +49,7 @@ public class RestOpenIndexAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { OpenIndexRequest openIndexRequest = new OpenIndexRequest(request.param("index")); + openIndexRequest.listenerThreaded(false); openIndexRequest.timeout(request.paramAsTime("timeout", timeValueSeconds(10))); client.admin().indices().open(openIndexRequest, new ActionListener() { @Override diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/optimize/RestOptimizeAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/optimize/RestOptimizeAction.java index b76ed7d8947..bfeee9a260c 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/optimize/RestOptimizeAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/optimize/RestOptimizeAction.java @@ -57,6 +57,7 @@ public class RestOptimizeAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { OptimizeRequest optimizeRequest = new OptimizeRequest(RestActions.splitIndices(request.param("index"))); + optimizeRequest.listenerThreaded(false); try { optimizeRequest.waitForMerge(request.paramAsBoolean("wait_for_merge", optimizeRequest.waitForMerge())); optimizeRequest.maxNumSegments(request.paramAsInt("max_num_segments", optimizeRequest.maxNumSegments())); @@ -64,8 +65,6 @@ public class RestOptimizeAction extends BaseRestHandler { optimizeRequest.flush(request.paramAsBoolean("flush", optimizeRequest.flush())); optimizeRequest.refresh(request.paramAsBoolean("refresh", optimizeRequest.refresh())); - // we just send back a response, no need to fork a listener - optimizeRequest.listenerThreaded(false); BroadcastOperationThreading operationThreading = BroadcastOperationThreading.fromString(request.param("operation_threading"), BroadcastOperationThreading.SINGLE_THREAD); if (operationThreading == BroadcastOperationThreading.NO_THREADS) { // since we don't spawn, don't allow no_threads, but change it to a single thread diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/refresh/RestRefreshAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/refresh/RestRefreshAction.java index ffc88a74eb0..8b4b3a68361 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/refresh/RestRefreshAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/refresh/RestRefreshAction.java @@ -56,7 +56,6 @@ public class RestRefreshAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { RefreshRequest refreshRequest = new RefreshRequest(RestActions.splitIndices(request.param("index"))); - // we just send back a response, no need to fork a listener refreshRequest.listenerThreaded(false); BroadcastOperationThreading operationThreading = BroadcastOperationThreading.fromString(request.param("operation_threading"), BroadcastOperationThreading.SINGLE_THREAD); if (operationThreading == BroadcastOperationThreading.NO_THREADS) { diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/segments/RestIndicesSegmentsAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/segments/RestIndicesSegmentsAction.java index 781514c86d9..21c0417232f 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/segments/RestIndicesSegmentsAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/segments/RestIndicesSegmentsAction.java @@ -51,7 +51,6 @@ public class RestIndicesSegmentsAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { IndicesSegmentsRequest indicesSegmentsRequest = new IndicesSegmentsRequest(splitIndices(request.param("index"))); - // we just send back a response, no need to fork a listener indicesSegmentsRequest.listenerThreaded(false); BroadcastOperationThreading operationThreading = BroadcastOperationThreading.fromString(request.param("operation_threading"), BroadcastOperationThreading.SINGLE_THREAD); if (operationThreading == BroadcastOperationThreading.NO_THREADS) { diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/settings/RestGetSettingsAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/settings/RestGetSettingsAction.java index f1700252221..469896a241e 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/settings/RestGetSettingsAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/settings/RestGetSettingsAction.java @@ -64,6 +64,7 @@ public class RestGetSettingsAction extends BaseRestHandler { .filterRoutingTable(true) .filterNodes(true) .filteredIndices(indices); + clusterStateRequest.listenerThreaded(false); client.admin().cluster().state(clusterStateRequest, new ActionListener() { @Override diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/settings/RestUpdateSettingsAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/settings/RestUpdateSettingsAction.java index 55cf966ce0f..234a09d73b2 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/settings/RestUpdateSettingsAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/settings/RestUpdateSettingsAction.java @@ -55,6 +55,8 @@ public class RestUpdateSettingsAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { UpdateSettingsRequest updateSettingsRequest = updateSettingsRequest(splitIndices(request.param("index"))); + updateSettingsRequest.listenerThreaded(false); + ImmutableSettings.Builder updateSettings = ImmutableSettings.settingsBuilder(); String bodySettings = request.contentAsString(); if (Strings.hasText(bodySettings)) { diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/stats/RestIndicesStatsAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/stats/RestIndicesStatsAction.java index 1fba3e3f0b7..8b84f866931 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/stats/RestIndicesStatsAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/stats/RestIndicesStatsAction.java @@ -81,6 +81,7 @@ public class RestIndicesStatsAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { IndicesStatsRequest indicesStatsRequest = new IndicesStatsRequest(); + indicesStatsRequest.listenerThreaded(false); boolean clear = request.paramAsBoolean("clear", false); if (clear) { indicesStatsRequest.clear(); @@ -136,6 +137,7 @@ public class RestIndicesStatsAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { IndicesStatsRequest indicesStatsRequest = new IndicesStatsRequest(); + indicesStatsRequest.listenerThreaded(false); indicesStatsRequest.clear().docs(true); indicesStatsRequest.indices(splitIndices(request.param("index"))); indicesStatsRequest.types(splitTypes(request.param("types"))); @@ -173,6 +175,7 @@ public class RestIndicesStatsAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { IndicesStatsRequest indicesStatsRequest = new IndicesStatsRequest(); + indicesStatsRequest.listenerThreaded(false); indicesStatsRequest.clear().store(true); indicesStatsRequest.indices(splitIndices(request.param("index"))); indicesStatsRequest.types(splitTypes(request.param("types"))); @@ -210,6 +213,7 @@ public class RestIndicesStatsAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { IndicesStatsRequest indicesStatsRequest = new IndicesStatsRequest(); + indicesStatsRequest.listenerThreaded(false); indicesStatsRequest.clear().indexing(true); indicesStatsRequest.indices(splitIndices(request.param("index"))); if (request.hasParam("types")) { @@ -253,6 +257,7 @@ public class RestIndicesStatsAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { IndicesStatsRequest indicesStatsRequest = new IndicesStatsRequest(); + indicesStatsRequest.listenerThreaded(false); indicesStatsRequest.clear().search(true); indicesStatsRequest.indices(splitIndices(request.param("index"))); if (request.hasParam("groups")) { @@ -296,6 +301,7 @@ public class RestIndicesStatsAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { IndicesStatsRequest indicesStatsRequest = new IndicesStatsRequest(); + indicesStatsRequest.listenerThreaded(false); indicesStatsRequest.clear().get(true); indicesStatsRequest.indices(splitIndices(request.param("index"))); @@ -332,6 +338,7 @@ public class RestIndicesStatsAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { IndicesStatsRequest indicesStatsRequest = new IndicesStatsRequest(); + indicesStatsRequest.listenerThreaded(false); indicesStatsRequest.clear().merge(true); indicesStatsRequest.indices(splitIndices(request.param("index"))); indicesStatsRequest.types(splitTypes(request.param("types"))); @@ -369,6 +376,7 @@ public class RestIndicesStatsAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { IndicesStatsRequest indicesStatsRequest = new IndicesStatsRequest(); + indicesStatsRequest.listenerThreaded(false); indicesStatsRequest.clear().flush(true); indicesStatsRequest.indices(splitIndices(request.param("index"))); indicesStatsRequest.types(splitTypes(request.param("types"))); @@ -406,6 +414,7 @@ public class RestIndicesStatsAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { IndicesStatsRequest indicesStatsRequest = new IndicesStatsRequest(); + indicesStatsRequest.listenerThreaded(false); indicesStatsRequest.clear().warmer(true); indicesStatsRequest.indices(splitIndices(request.param("index"))); indicesStatsRequest.types(splitTypes(request.param("types"))); @@ -443,6 +452,7 @@ public class RestIndicesStatsAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { IndicesStatsRequest indicesStatsRequest = new IndicesStatsRequest(); + indicesStatsRequest.listenerThreaded(false); indicesStatsRequest.clear().refresh(true); indicesStatsRequest.indices(splitIndices(request.param("index"))); indicesStatsRequest.types(splitTypes(request.param("types"))); diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/status/RestIndicesStatusAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/status/RestIndicesStatusAction.java index 36ebbd7562c..5c671ccde03 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/status/RestIndicesStatusAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/status/RestIndicesStatusAction.java @@ -58,7 +58,6 @@ public class RestIndicesStatusAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { IndicesStatusRequest indicesStatusRequest = new IndicesStatusRequest(splitIndices(request.param("index"))); - // we just send back a response, no need to fork a listener indicesStatusRequest.listenerThreaded(false); indicesStatusRequest.recovery(request.paramAsBoolean("recovery", indicesStatusRequest.recovery())); indicesStatusRequest.snapshot(request.paramAsBoolean("snapshot", indicesStatusRequest.snapshot())); diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/template/delete/RestDeleteIndexTemplateAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/template/delete/RestDeleteIndexTemplateAction.java index f581da03da0..613adc48028 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/template/delete/RestDeleteIndexTemplateAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/template/delete/RestDeleteIndexTemplateAction.java @@ -49,6 +49,7 @@ public class RestDeleteIndexTemplateAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { DeleteIndexTemplateRequest deleteIndexTemplateRequest = new DeleteIndexTemplateRequest(request.param("name")); + deleteIndexTemplateRequest.listenerThreaded(false); deleteIndexTemplateRequest.timeout(request.paramAsTime("timeout", timeValueSeconds(10))); client.admin().indices().deleteTemplate(deleteIndexTemplateRequest, new ActionListener() { @Override diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/template/get/RestGetIndexTemplateAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/template/get/RestGetIndexTemplateAction.java index c3ec9a6f69f..1dd8867f180 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/template/get/RestGetIndexTemplateAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/template/get/RestGetIndexTemplateAction.java @@ -66,6 +66,8 @@ public class RestGetIndexTemplateAction extends BaseRestHandler { .filteredIndexTemplates(request.param("name")) .filteredIndices("_na"); + clusterStateRequest.listenerThreaded(false); + client.admin().cluster().state(clusterStateRequest, new ActionListener() { @Override public void onResponse(ClusterStateResponse response) { diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/template/put/RestPutIndexTemplateAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/template/put/RestPutIndexTemplateAction.java index a65a2dbb9e8..d0152ca244a 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/template/put/RestPutIndexTemplateAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/template/put/RestPutIndexTemplateAction.java @@ -59,7 +59,7 @@ public class RestPutIndexTemplateAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { PutIndexTemplateRequest putRequest = new PutIndexTemplateRequest(request.param("name")); - + putRequest.listenerThreaded(false); putRequest.template(request.param("template", putRequest.template())); putRequest.order(request.paramAsInt("order", putRequest.order())); diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/validate/query/RestValidateQueryAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/validate/query/RestValidateQueryAction.java index 9d5058814e0..0e43ebe48ff 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/validate/query/RestValidateQueryAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/validate/query/RestValidateQueryAction.java @@ -61,7 +61,6 @@ public class RestValidateQueryAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { ValidateQueryRequest validateQueryRequest = new ValidateQueryRequest(RestActions.splitIndices(request.param("index"))); - // we just send back a response, no need to fork a listener validateQueryRequest.listenerThreaded(false); try { BroadcastOperationThreading operationThreading = BroadcastOperationThreading.fromString(request.param("operation_threading"), BroadcastOperationThreading.SINGLE_THREAD); @@ -109,7 +108,7 @@ public class RestValidateQueryAction extends BaseRestHandler { buildBroadcastShardsHeader(builder, response); - if(response.queryExplanations() != null && !response.queryExplanations().isEmpty()) { + if (response.queryExplanations() != null && !response.queryExplanations().isEmpty()) { builder.startArray("explanations"); for (QueryExplanation explanation : response.queryExplanations()) { builder.startObject(); diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/warmer/delete/RestDeleteWarmerAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/warmer/delete/RestDeleteWarmerAction.java index 38d104bf930..eaf9bd430f8 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/warmer/delete/RestDeleteWarmerAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/warmer/delete/RestDeleteWarmerAction.java @@ -51,6 +51,7 @@ public class RestDeleteWarmerAction extends BaseRestHandler { public void handleRequest(final RestRequest request, final RestChannel channel) { DeleteWarmerRequest deleteWarmerRequest = new DeleteWarmerRequest(request.param("name")) .indices(RestActions.splitIndices(request.param("index"))); + deleteWarmerRequest.listenerThreaded(false); client.admin().indices().deleteWarmer(deleteWarmerRequest, new ActionListener() { @Override public void onResponse(DeleteWarmerResponse response) { diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/warmer/get/RestGetWarmerAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/warmer/get/RestGetWarmerAction.java index 7052a01f8cd..509275f17f4 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/warmer/get/RestGetWarmerAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/warmer/get/RestGetWarmerAction.java @@ -67,6 +67,8 @@ public class RestGetWarmerAction extends BaseRestHandler { .filterMetaData(false) .filteredIndices(indices); + clusterStateRequest.listenerThreaded(false); + client.admin().cluster().state(clusterStateRequest, new ActionListener() { @Override public void onResponse(ClusterStateResponse response) { diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/warmer/put/RestPutWarmerAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/warmer/put/RestPutWarmerAction.java index 8f4432db6cc..ab59758ae0d 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/warmer/put/RestPutWarmerAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/warmer/put/RestPutWarmerAction.java @@ -50,6 +50,7 @@ public class RestPutWarmerAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { PutWarmerRequest putWarmerRequest = new PutWarmerRequest(request.param("name")); + putWarmerRequest.listenerThreaded(false); SearchRequest searchRequest = new SearchRequest(RestActions.splitIndices(request.param("index"))) .types(RestActions.splitTypes(request.param("type"))) .source(request.contentByteArray(), request.contentByteArrayOffset(), request.contentLength(), request.contentUnsafe()); diff --git a/src/main/java/org/elasticsearch/rest/action/bulk/RestBulkAction.java b/src/main/java/org/elasticsearch/rest/action/bulk/RestBulkAction.java index a7b4e4172d6..7a0714cac2e 100644 --- a/src/main/java/org/elasticsearch/rest/action/bulk/RestBulkAction.java +++ b/src/main/java/org/elasticsearch/rest/action/bulk/RestBulkAction.java @@ -50,8 +50,6 @@ import static org.elasticsearch.rest.action.support.RestXContentBuilder.restCont * { "create" : { "_index" : "test", "_type" : "type1", "_id" : "1" } * { "type1" : { "field1" : "value1" } } * - * - * */ public class RestBulkAction extends BaseRestHandler { @@ -70,6 +68,7 @@ public class RestBulkAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { BulkRequest bulkRequest = Requests.bulkRequest(); + bulkRequest.listenerThreaded(false); String defaultIndex = request.param("index"); String defaultType = request.param("type"); diff --git a/src/main/java/org/elasticsearch/rest/action/count/RestCountAction.java b/src/main/java/org/elasticsearch/rest/action/count/RestCountAction.java index 4cc3a128691..68b9ffdd701 100644 --- a/src/main/java/org/elasticsearch/rest/action/count/RestCountAction.java +++ b/src/main/java/org/elasticsearch/rest/action/count/RestCountAction.java @@ -61,7 +61,6 @@ public class RestCountAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { CountRequest countRequest = new CountRequest(RestActions.splitIndices(request.param("index"))); - // we just send back a response, no need to fork a listener countRequest.listenerThreaded(false); try { BroadcastOperationThreading operationThreading = BroadcastOperationThreading.fromString(request.param("operation_threading"), BroadcastOperationThreading.SINGLE_THREAD); diff --git a/src/main/java/org/elasticsearch/rest/action/delete/RestDeleteAction.java b/src/main/java/org/elasticsearch/rest/action/delete/RestDeleteAction.java index 7309d443a58..e4af0556052 100644 --- a/src/main/java/org/elasticsearch/rest/action/delete/RestDeleteAction.java +++ b/src/main/java/org/elasticsearch/rest/action/delete/RestDeleteAction.java @@ -54,15 +54,15 @@ public class RestDeleteAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { DeleteRequest deleteRequest = new DeleteRequest(request.param("index"), request.param("type"), request.param("id")); + + deleteRequest.listenerThreaded(false); + deleteRequest.operationThreaded(true); + deleteRequest.parent(request.param("parent")); deleteRequest.routing(request.param("routing")); deleteRequest.timeout(request.paramAsTime("timeout", DeleteRequest.DEFAULT_TIMEOUT)); deleteRequest.refresh(request.paramAsBoolean("refresh", deleteRequest.refresh())); deleteRequest.version(RestActions.parseVersion(request)); - // we just send a response, no need to fork - deleteRequest.listenerThreaded(false); - // we don't spawn, then fork if local - deleteRequest.operationThreaded(true); deleteRequest.versionType(VersionType.fromString(request.param("version_type"), deleteRequest.versionType())); String replicationType = request.param("replication"); diff --git a/src/main/java/org/elasticsearch/rest/action/deletebyquery/RestDeleteByQueryAction.java b/src/main/java/org/elasticsearch/rest/action/deletebyquery/RestDeleteByQueryAction.java index 0e5107e25a6..a094b467bba 100644 --- a/src/main/java/org/elasticsearch/rest/action/deletebyquery/RestDeleteByQueryAction.java +++ b/src/main/java/org/elasticsearch/rest/action/deletebyquery/RestDeleteByQueryAction.java @@ -58,7 +58,6 @@ public class RestDeleteByQueryAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { DeleteByQueryRequest deleteByQueryRequest = new DeleteByQueryRequest(splitIndices(request.param("index"))); - // we just build a response and send it, no need to fork a thread deleteByQueryRequest.listenerThreaded(false); try { if (request.hasContent()) { diff --git a/src/main/java/org/elasticsearch/rest/action/get/RestGetAction.java b/src/main/java/org/elasticsearch/rest/action/get/RestGetAction.java index dd7bdc3375d..b6fc0784dff 100644 --- a/src/main/java/org/elasticsearch/rest/action/get/RestGetAction.java +++ b/src/main/java/org/elasticsearch/rest/action/get/RestGetAction.java @@ -50,9 +50,7 @@ public class RestGetAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { final GetRequest getRequest = new GetRequest(request.param("index"), request.param("type"), request.param("id")); - // no need to have a threaded listener since we just send back a response getRequest.listenerThreaded(false); - // if we have a local operation, execute it on a thread since we don't spawn getRequest.operationThreaded(true); getRequest.refresh(request.paramAsBoolean("refresh", getRequest.refresh())); getRequest.parent(request.param("parent")); diff --git a/src/main/java/org/elasticsearch/rest/action/index/RestIndexAction.java b/src/main/java/org/elasticsearch/rest/action/index/RestIndexAction.java index 14f702a1cf2..d8b7a6b04db 100644 --- a/src/main/java/org/elasticsearch/rest/action/index/RestIndexAction.java +++ b/src/main/java/org/elasticsearch/rest/action/index/RestIndexAction.java @@ -66,6 +66,8 @@ public class RestIndexAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { IndexRequest indexRequest = new IndexRequest(request.param("index"), request.param("type"), request.param("id")); + indexRequest.listenerThreaded(false); + indexRequest.operationThreaded(true); indexRequest.routing(request.param("routing")); indexRequest.parent(request.param("parent")); // order is important, set it after routing, so it will set the routing indexRequest.timestamp(request.param("timestamp")); @@ -102,10 +104,6 @@ public class RestIndexAction extends BaseRestHandler { if (consistencyLevel != null) { indexRequest.consistencyLevel(WriteConsistencyLevel.fromString(consistencyLevel)); } - // we just send a response, no need to fork - indexRequest.listenerThreaded(false); - // we don't spawn, then fork if local - indexRequest.operationThreaded(true); client.index(indexRequest, new ActionListener() { @Override public void onResponse(IndexResponse response) { diff --git a/src/main/java/org/elasticsearch/rest/action/main/RestMainAction.java b/src/main/java/org/elasticsearch/rest/action/main/RestMainAction.java index 3bb4062c175..0970b6fa263 100644 --- a/src/main/java/org/elasticsearch/rest/action/main/RestMainAction.java +++ b/src/main/java/org/elasticsearch/rest/action/main/RestMainAction.java @@ -52,6 +52,7 @@ public class RestMainAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { ClusterStateRequest clusterStateRequest = new ClusterStateRequest(); + clusterStateRequest.listenerThreaded(false); clusterStateRequest.masterNodeTimeout(TimeValue.timeValueMillis(0)); clusterStateRequest.local(true); clusterStateRequest.filterAll().filterBlocks(false); diff --git a/src/main/java/org/elasticsearch/rest/action/mlt/RestMoreLikeThisAction.java b/src/main/java/org/elasticsearch/rest/action/mlt/RestMoreLikeThisAction.java index 443dcc881af..6c94982c336 100644 --- a/src/main/java/org/elasticsearch/rest/action/mlt/RestMoreLikeThisAction.java +++ b/src/main/java/org/elasticsearch/rest/action/mlt/RestMoreLikeThisAction.java @@ -55,6 +55,7 @@ public class RestMoreLikeThisAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { MoreLikeThisRequest mltRequest = moreLikeThisRequest(request.param("index")).type(request.param("type")).id(request.param("id")); + mltRequest.listenerThreaded(false); try { mltRequest.fields(request.paramAsStringArray("mlt_fields", null)); mltRequest.percentTermsToMatch(request.paramAsFloat("percent_terms_to_match", -1)); diff --git a/src/main/java/org/elasticsearch/rest/action/percolate/RestPercolateAction.java b/src/main/java/org/elasticsearch/rest/action/percolate/RestPercolateAction.java index 06da3a722d2..95a94e89c3c 100644 --- a/src/main/java/org/elasticsearch/rest/action/percolate/RestPercolateAction.java +++ b/src/main/java/org/elasticsearch/rest/action/percolate/RestPercolateAction.java @@ -51,6 +51,7 @@ public class RestPercolateAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { PercolateRequest percolateRequest = new PercolateRequest(request.param("index"), request.param("type")); + percolateRequest.listenerThreaded(false); percolateRequest.source(request.contentByteArray(), request.contentByteArrayOffset(), request.contentLength(), request.contentUnsafe()); // we just send a response, no need to fork diff --git a/src/main/java/org/elasticsearch/rest/action/search/RestMultiSearchAction.java b/src/main/java/org/elasticsearch/rest/action/search/RestMultiSearchAction.java index f9d3af10e1d..91d01fef984 100644 --- a/src/main/java/org/elasticsearch/rest/action/search/RestMultiSearchAction.java +++ b/src/main/java/org/elasticsearch/rest/action/search/RestMultiSearchAction.java @@ -56,6 +56,7 @@ public class RestMultiSearchAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { MultiSearchRequest multiSearchRequest = new MultiSearchRequest(); + multiSearchRequest.listenerThreaded(false); String[] indices = RestActions.splitIndices(request.param("index")); String[] types = RestActions.splitTypes(request.param("type")); diff --git a/src/main/java/org/elasticsearch/rest/action/search/RestSearchScrollAction.java b/src/main/java/org/elasticsearch/rest/action/search/RestSearchScrollAction.java index aa635c99ac1..b778631de97 100644 --- a/src/main/java/org/elasticsearch/rest/action/search/RestSearchScrollAction.java +++ b/src/main/java/org/elasticsearch/rest/action/search/RestSearchScrollAction.java @@ -60,12 +60,12 @@ public class RestSearchScrollAction extends BaseRestHandler { scrollId = request.contentAsString(); } SearchScrollRequest searchScrollRequest = new SearchScrollRequest(scrollId); + searchScrollRequest.listenerThreaded(false); try { String scroll = request.param("scroll"); if (scroll != null) { searchScrollRequest.scroll(new Scroll(parseTimeValue(scroll, null))); } - searchScrollRequest.listenerThreaded(false); SearchOperationThreading operationThreading = SearchOperationThreading.fromString(request.param("operation_threading"), null); if (operationThreading != null) { if (operationThreading == SearchOperationThreading.NO_THREADS) { diff --git a/src/main/java/org/elasticsearch/rest/action/update/RestUpdateAction.java b/src/main/java/org/elasticsearch/rest/action/update/RestUpdateAction.java index 9f06fe6f446..31fbd290d6f 100644 --- a/src/main/java/org/elasticsearch/rest/action/update/RestUpdateAction.java +++ b/src/main/java/org/elasticsearch/rest/action/update/RestUpdateAction.java @@ -55,6 +55,7 @@ public class RestUpdateAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { UpdateRequest updateRequest = new UpdateRequest(request.param("index"), request.param("type"), request.param("id")); + updateRequest.listenerThreaded(false); updateRequest.routing(request.param("routing")); updateRequest.parent(request.param("parent")); // order is important, set it after routing, so it will set the routing updateRequest.timeout(request.paramAsTime("timeout", updateRequest.timeout())); @@ -68,8 +69,6 @@ public class RestUpdateAction extends BaseRestHandler { updateRequest.consistencyLevel(WriteConsistencyLevel.fromString(consistencyLevel)); } updateRequest.percolate(request.param("percolate", null)); - // we just send a response, no need to fork - updateRequest.listenerThreaded(false); updateRequest.script(request.param("script")); updateRequest.scriptLang(request.param("lang")); for (Map.Entry entry : request.params().entrySet()) {