From 33e7d769cad8720c8c5d69a07c20a27baa4bab0b Mon Sep 17 00:00:00 2001 From: Martijn van Groningen Date: Wed, 5 Sep 2012 19:16:54 +0200 Subject: [PATCH] Fixed no valid missing index type error. --- .../indices/cache/clear/RestClearIndicesCacheAction.java | 4 +++- .../rest/action/admin/indices/flush/RestFlushAction.java | 4 +++- .../indices/gateway/snapshot/RestGatewaySnapshotAction.java | 4 +++- .../action/admin/indices/optimize/RestOptimizeAction.java | 4 +++- .../rest/action/admin/indices/refresh/RestRefreshAction.java | 4 +++- .../admin/indices/segments/RestIndicesSegmentsAction.java | 4 +++- .../action/admin/indices/stats/RestIndicesStatsAction.java | 4 +++- .../action/admin/indices/status/RestIndicesStatusAction.java | 4 +++- .../indices/validate/query/RestValidateQueryAction.java | 4 +++- .../org/elasticsearch/rest/action/count/RestCountAction.java | 4 +++- .../rest/action/search/RestMultiSearchAction.java | 5 ++++- .../elasticsearch/rest/action/search/RestSearchAction.java | 4 +++- 12 files changed, 37 insertions(+), 12 deletions(-) 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 d4f26d1ee47..7d530459a65 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 @@ -59,7 +59,9 @@ public class RestClearIndicesCacheAction extends BaseRestHandler { public void handleRequest(final RestRequest request, final RestChannel channel) { ClearIndicesCacheRequest clearIndicesCacheRequest = new ClearIndicesCacheRequest(RestActions.splitIndices(request.param("index"))); clearIndicesCacheRequest.listenerThreaded(false); - clearIndicesCacheRequest.ignoreIndices(IgnoreIndices.fromString(request.param("ignore_indices"))); + if (request.hasParam("ignore_indices")) { + clearIndicesCacheRequest.ignoreIndices(IgnoreIndices.fromString(request.param("ignore_indices"))); + } try { clearIndicesCacheRequest.filterCache(request.paramAsBoolean("filter", clearIndicesCacheRequest.filterCache())); clearIndicesCacheRequest.fieldDataCache(request.paramAsBoolean("field_data", clearIndicesCacheRequest.fieldDataCache())); 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 c387b298c5a..02d8fa3de2a 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 @@ -58,7 +58,9 @@ public class RestFlushAction extends BaseRestHandler { public void handleRequest(final RestRequest request, final RestChannel channel) { FlushRequest flushRequest = new FlushRequest(RestActions.splitIndices(request.param("index"))); flushRequest.listenerThreaded(false); - flushRequest.ignoreIndices(IgnoreIndices.fromString(request.param("ignore_indices"))); + if (request.hasParam("ignore_indices")) { + flushRequest.ignoreIndices(IgnoreIndices.fromString(request.param("ignore_indices"))); + } 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/gateway/snapshot/RestGatewaySnapshotAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/gateway/snapshot/RestGatewaySnapshotAction.java index 82bbb2f7952..f2f14968c68 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/gateway/snapshot/RestGatewaySnapshotAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/gateway/snapshot/RestGatewaySnapshotAction.java @@ -53,7 +53,9 @@ public class RestGatewaySnapshotAction extends BaseRestHandler { public void handleRequest(final RestRequest request, final RestChannel channel) { GatewaySnapshotRequest gatewaySnapshotRequest = new GatewaySnapshotRequest(RestActions.splitIndices(request.param("index"))); gatewaySnapshotRequest.listenerThreaded(false); - gatewaySnapshotRequest.ignoreIndices(IgnoreIndices.fromString(request.param("ignore_indices"))); + if (request.hasParam("ignore_indices")) { + gatewaySnapshotRequest.ignoreIndices(IgnoreIndices.fromString(request.param("ignore_indices"))); + } client.admin().indices().gatewaySnapshot(gatewaySnapshotRequest, new ActionListener() { @Override public void onResponse(GatewaySnapshotResponse response) { 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 1efcb69357e..dd2eb4f04e1 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 @@ -59,7 +59,9 @@ public class RestOptimizeAction extends BaseRestHandler { public void handleRequest(final RestRequest request, final RestChannel channel) { OptimizeRequest optimizeRequest = new OptimizeRequest(RestActions.splitIndices(request.param("index"))); optimizeRequest.listenerThreaded(false); - optimizeRequest.ignoreIndices(IgnoreIndices.fromString(request.param("ignore_indices"))); + if (request.hasParam("ignore_indices")) { + optimizeRequest.ignoreIndices(IgnoreIndices.fromString(request.param("ignore_indices"))); + } try { optimizeRequest.waitForMerge(request.paramAsBoolean("wait_for_merge", optimizeRequest.waitForMerge())); optimizeRequest.maxNumSegments(request.paramAsInt("max_num_segments", optimizeRequest.maxNumSegments())); 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 ac26e12202c..21ff1803e5d 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 @@ -58,7 +58,9 @@ public class RestRefreshAction extends BaseRestHandler { public void handleRequest(final RestRequest request, final RestChannel channel) { RefreshRequest refreshRequest = new RefreshRequest(RestActions.splitIndices(request.param("index"))); refreshRequest.listenerThreaded(false); - refreshRequest.ignoreIndices(IgnoreIndices.fromString(request.param("ignore_indices"))); + if (request.hasParam("ignore_indices")) { + refreshRequest.ignoreIndices(IgnoreIndices.fromString(request.param("ignore_indices"))); + } 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/segments/RestIndicesSegmentsAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/segments/RestIndicesSegmentsAction.java index 9defc531cbd..7b7e8aa4e03 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 @@ -53,7 +53,9 @@ public class RestIndicesSegmentsAction extends BaseRestHandler { public void handleRequest(final RestRequest request, final RestChannel channel) { IndicesSegmentsRequest indicesSegmentsRequest = new IndicesSegmentsRequest(splitIndices(request.param("index"))); indicesSegmentsRequest.listenerThreaded(false); - indicesSegmentsRequest.ignoreIndices(IgnoreIndices.fromString(request.param("ignore_indices"))); + if (request.hasParam("ignore_indices")) { + indicesSegmentsRequest.ignoreIndices(IgnoreIndices.fromString(request.param("ignore_indices"))); + } 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/stats/RestIndicesStatsAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/stats/RestIndicesStatsAction.java index 8507bc6b262..e039eef5fa2 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 @@ -83,7 +83,9 @@ public class RestIndicesStatsAction extends BaseRestHandler { public void handleRequest(final RestRequest request, final RestChannel channel) { IndicesStatsRequest indicesStatsRequest = new IndicesStatsRequest(); indicesStatsRequest.listenerThreaded(false); - indicesStatsRequest.ignoreIndices(IgnoreIndices.fromString(request.param("ignore_indices"))); + if (request.hasParam("ignore_indices")) { + indicesStatsRequest.ignoreIndices(IgnoreIndices.fromString(request.param("ignore_indices"))); + } boolean clear = request.paramAsBoolean("clear", false); if (clear) { indicesStatsRequest.clear(); 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 d09e1a04259..3314ed1f051 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 @@ -60,7 +60,9 @@ public class RestIndicesStatusAction extends BaseRestHandler { public void handleRequest(final RestRequest request, final RestChannel channel) { IndicesStatusRequest indicesStatusRequest = new IndicesStatusRequest(splitIndices(request.param("index"))); indicesStatusRequest.listenerThreaded(false); - indicesStatusRequest.ignoreIndices(IgnoreIndices.fromString(request.param("ignore_indices"))); + if (request.hasParam("ignore_indices")) { + indicesStatusRequest.ignoreIndices(IgnoreIndices.fromString(request.param("ignore_indices"))); + } indicesStatusRequest.recovery(request.paramAsBoolean("recovery", indicesStatusRequest.recovery())); indicesStatusRequest.snapshot(request.paramAsBoolean("snapshot", indicesStatusRequest.snapshot())); BroadcastOperationThreading operationThreading = BroadcastOperationThreading.fromString(request.param("operation_threading"), BroadcastOperationThreading.SINGLE_THREAD); 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 db713ca605e..c89d9145354 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 @@ -63,7 +63,9 @@ public class RestValidateQueryAction extends BaseRestHandler { public void handleRequest(final RestRequest request, final RestChannel channel) { ValidateQueryRequest validateQueryRequest = new ValidateQueryRequest(RestActions.splitIndices(request.param("index"))); validateQueryRequest.listenerThreaded(false); - validateQueryRequest.ignoreIndices(IgnoreIndices.fromString(request.param("ignore_indices"))); + if (request.hasParam("ignore_indices")) { + validateQueryRequest.ignoreIndices(IgnoreIndices.fromString(request.param("ignore_indices"))); + } try { 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/count/RestCountAction.java b/src/main/java/org/elasticsearch/rest/action/count/RestCountAction.java index 0dfc6a6dae7..5d3aa8099f5 100644 --- a/src/main/java/org/elasticsearch/rest/action/count/RestCountAction.java +++ b/src/main/java/org/elasticsearch/rest/action/count/RestCountAction.java @@ -62,7 +62,9 @@ public class RestCountAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { CountRequest countRequest = new CountRequest(RestActions.splitIndices(request.param("index"))); - countRequest.ignoreIndices(IgnoreIndices.fromString(request.param("ignore_indices"))); + if (request.hasParam("ignore_indices")) { + countRequest.ignoreIndices(IgnoreIndices.fromString(request.param("ignore_indices"))); + } 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/search/RestMultiSearchAction.java b/src/main/java/org/elasticsearch/rest/action/search/RestMultiSearchAction.java index 22614e2812c..889fbbffa43 100644 --- a/src/main/java/org/elasticsearch/rest/action/search/RestMultiSearchAction.java +++ b/src/main/java/org/elasticsearch/rest/action/search/RestMultiSearchAction.java @@ -61,7 +61,10 @@ public class RestMultiSearchAction extends BaseRestHandler { String[] indices = RestActions.splitIndices(request.param("index")); String[] types = RestActions.splitTypes(request.param("type")); - IgnoreIndices ignoreIndices = IgnoreIndices.fromString(request.param("ignore_indices")); + IgnoreIndices ignoreIndices = null; + if (request.hasParam("ignore_indices")) { + IgnoreIndices.fromString(request.param("ignore_indices")); + } try { multiSearchRequest.add(request.content(), request.contentUnsafe(), indices, types, request.param("search_type"), ignoreIndices); diff --git a/src/main/java/org/elasticsearch/rest/action/search/RestSearchAction.java b/src/main/java/org/elasticsearch/rest/action/search/RestSearchAction.java index a2a74b4cb1b..ac3aede4a41 100644 --- a/src/main/java/org/elasticsearch/rest/action/search/RestSearchAction.java +++ b/src/main/java/org/elasticsearch/rest/action/search/RestSearchAction.java @@ -142,7 +142,9 @@ public class RestSearchAction extends BaseRestHandler { searchRequest.queryHint(request.param("query_hint")); searchRequest.routing(request.param("routing")); searchRequest.preference(request.param("preference")); - searchRequest.ignoreIndices(IgnoreIndices.fromString(request.param("ignore_indices"))); + if (request.hasParam("ignore_indices")) { + searchRequest.ignoreIndices(IgnoreIndices.fromString(request.param("ignore_indices"))); + } return searchRequest; }