Fixed no valid missing index type error.

This commit is contained in:
Martijn van Groningen 2012-09-05 19:16:54 +02:00
parent 24ce2ef537
commit 33e7d769ca
12 changed files with 37 additions and 12 deletions

View File

@ -59,7 +59,9 @@ public class RestClearIndicesCacheAction extends BaseRestHandler {
public void handleRequest(final RestRequest request, final RestChannel channel) { public void handleRequest(final RestRequest request, final RestChannel channel) {
ClearIndicesCacheRequest clearIndicesCacheRequest = new ClearIndicesCacheRequest(RestActions.splitIndices(request.param("index"))); ClearIndicesCacheRequest clearIndicesCacheRequest = new ClearIndicesCacheRequest(RestActions.splitIndices(request.param("index")));
clearIndicesCacheRequest.listenerThreaded(false); 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 { try {
clearIndicesCacheRequest.filterCache(request.paramAsBoolean("filter", clearIndicesCacheRequest.filterCache())); clearIndicesCacheRequest.filterCache(request.paramAsBoolean("filter", clearIndicesCacheRequest.filterCache()));
clearIndicesCacheRequest.fieldDataCache(request.paramAsBoolean("field_data", clearIndicesCacheRequest.fieldDataCache())); clearIndicesCacheRequest.fieldDataCache(request.paramAsBoolean("field_data", clearIndicesCacheRequest.fieldDataCache()));

View File

@ -58,7 +58,9 @@ public class RestFlushAction extends BaseRestHandler {
public void handleRequest(final RestRequest request, final RestChannel channel) { public void handleRequest(final RestRequest request, final RestChannel channel) {
FlushRequest flushRequest = new FlushRequest(RestActions.splitIndices(request.param("index"))); FlushRequest flushRequest = new FlushRequest(RestActions.splitIndices(request.param("index")));
flushRequest.listenerThreaded(false); 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); BroadcastOperationThreading operationThreading = BroadcastOperationThreading.fromString(request.param("operationThreading"), BroadcastOperationThreading.SINGLE_THREAD);
if (operationThreading == BroadcastOperationThreading.NO_THREADS) { if (operationThreading == BroadcastOperationThreading.NO_THREADS) {
// since we don't spawn, don't allow no_threads, but change it to a single thread // since we don't spawn, don't allow no_threads, but change it to a single thread

View File

@ -53,7 +53,9 @@ public class RestGatewaySnapshotAction extends BaseRestHandler {
public void handleRequest(final RestRequest request, final RestChannel channel) { public void handleRequest(final RestRequest request, final RestChannel channel) {
GatewaySnapshotRequest gatewaySnapshotRequest = new GatewaySnapshotRequest(RestActions.splitIndices(request.param("index"))); GatewaySnapshotRequest gatewaySnapshotRequest = new GatewaySnapshotRequest(RestActions.splitIndices(request.param("index")));
gatewaySnapshotRequest.listenerThreaded(false); 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<GatewaySnapshotResponse>() { client.admin().indices().gatewaySnapshot(gatewaySnapshotRequest, new ActionListener<GatewaySnapshotResponse>() {
@Override @Override
public void onResponse(GatewaySnapshotResponse response) { public void onResponse(GatewaySnapshotResponse response) {

View File

@ -59,7 +59,9 @@ public class RestOptimizeAction extends BaseRestHandler {
public void handleRequest(final RestRequest request, final RestChannel channel) { public void handleRequest(final RestRequest request, final RestChannel channel) {
OptimizeRequest optimizeRequest = new OptimizeRequest(RestActions.splitIndices(request.param("index"))); OptimizeRequest optimizeRequest = new OptimizeRequest(RestActions.splitIndices(request.param("index")));
optimizeRequest.listenerThreaded(false); 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 { try {
optimizeRequest.waitForMerge(request.paramAsBoolean("wait_for_merge", optimizeRequest.waitForMerge())); optimizeRequest.waitForMerge(request.paramAsBoolean("wait_for_merge", optimizeRequest.waitForMerge()));
optimizeRequest.maxNumSegments(request.paramAsInt("max_num_segments", optimizeRequest.maxNumSegments())); optimizeRequest.maxNumSegments(request.paramAsInt("max_num_segments", optimizeRequest.maxNumSegments()));

View File

@ -58,7 +58,9 @@ public class RestRefreshAction extends BaseRestHandler {
public void handleRequest(final RestRequest request, final RestChannel channel) { public void handleRequest(final RestRequest request, final RestChannel channel) {
RefreshRequest refreshRequest = new RefreshRequest(RestActions.splitIndices(request.param("index"))); RefreshRequest refreshRequest = new RefreshRequest(RestActions.splitIndices(request.param("index")));
refreshRequest.listenerThreaded(false); 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); BroadcastOperationThreading operationThreading = BroadcastOperationThreading.fromString(request.param("operation_threading"), BroadcastOperationThreading.SINGLE_THREAD);
if (operationThreading == BroadcastOperationThreading.NO_THREADS) { if (operationThreading == BroadcastOperationThreading.NO_THREADS) {
// since we don't spawn, don't allow no_threads, but change it to a single thread // since we don't spawn, don't allow no_threads, but change it to a single thread

View File

@ -53,7 +53,9 @@ public class RestIndicesSegmentsAction extends BaseRestHandler {
public void handleRequest(final RestRequest request, final RestChannel channel) { public void handleRequest(final RestRequest request, final RestChannel channel) {
IndicesSegmentsRequest indicesSegmentsRequest = new IndicesSegmentsRequest(splitIndices(request.param("index"))); IndicesSegmentsRequest indicesSegmentsRequest = new IndicesSegmentsRequest(splitIndices(request.param("index")));
indicesSegmentsRequest.listenerThreaded(false); 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); BroadcastOperationThreading operationThreading = BroadcastOperationThreading.fromString(request.param("operation_threading"), BroadcastOperationThreading.SINGLE_THREAD);
if (operationThreading == BroadcastOperationThreading.NO_THREADS) { if (operationThreading == BroadcastOperationThreading.NO_THREADS) {
// since we don't spawn, don't allow no_threads, but change it to a single thread // since we don't spawn, don't allow no_threads, but change it to a single thread

View File

@ -83,7 +83,9 @@ public class RestIndicesStatsAction extends BaseRestHandler {
public void handleRequest(final RestRequest request, final RestChannel channel) { public void handleRequest(final RestRequest request, final RestChannel channel) {
IndicesStatsRequest indicesStatsRequest = new IndicesStatsRequest(); IndicesStatsRequest indicesStatsRequest = new IndicesStatsRequest();
indicesStatsRequest.listenerThreaded(false); 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); boolean clear = request.paramAsBoolean("clear", false);
if (clear) { if (clear) {
indicesStatsRequest.clear(); indicesStatsRequest.clear();

View File

@ -60,7 +60,9 @@ public class RestIndicesStatusAction extends BaseRestHandler {
public void handleRequest(final RestRequest request, final RestChannel channel) { public void handleRequest(final RestRequest request, final RestChannel channel) {
IndicesStatusRequest indicesStatusRequest = new IndicesStatusRequest(splitIndices(request.param("index"))); IndicesStatusRequest indicesStatusRequest = new IndicesStatusRequest(splitIndices(request.param("index")));
indicesStatusRequest.listenerThreaded(false); 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.recovery(request.paramAsBoolean("recovery", indicesStatusRequest.recovery()));
indicesStatusRequest.snapshot(request.paramAsBoolean("snapshot", indicesStatusRequest.snapshot())); indicesStatusRequest.snapshot(request.paramAsBoolean("snapshot", indicesStatusRequest.snapshot()));
BroadcastOperationThreading operationThreading = BroadcastOperationThreading.fromString(request.param("operation_threading"), BroadcastOperationThreading.SINGLE_THREAD); BroadcastOperationThreading operationThreading = BroadcastOperationThreading.fromString(request.param("operation_threading"), BroadcastOperationThreading.SINGLE_THREAD);

View File

@ -63,7 +63,9 @@ public class RestValidateQueryAction extends BaseRestHandler {
public void handleRequest(final RestRequest request, final RestChannel channel) { public void handleRequest(final RestRequest request, final RestChannel channel) {
ValidateQueryRequest validateQueryRequest = new ValidateQueryRequest(RestActions.splitIndices(request.param("index"))); ValidateQueryRequest validateQueryRequest = new ValidateQueryRequest(RestActions.splitIndices(request.param("index")));
validateQueryRequest.listenerThreaded(false); 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 { try {
BroadcastOperationThreading operationThreading = BroadcastOperationThreading.fromString(request.param("operation_threading"), BroadcastOperationThreading.SINGLE_THREAD); BroadcastOperationThreading operationThreading = BroadcastOperationThreading.fromString(request.param("operation_threading"), BroadcastOperationThreading.SINGLE_THREAD);
if (operationThreading == BroadcastOperationThreading.NO_THREADS) { if (operationThreading == BroadcastOperationThreading.NO_THREADS) {

View File

@ -62,7 +62,9 @@ public class RestCountAction extends BaseRestHandler {
@Override @Override
public void handleRequest(final RestRequest request, final RestChannel channel) { public void handleRequest(final RestRequest request, final RestChannel channel) {
CountRequest countRequest = new CountRequest(RestActions.splitIndices(request.param("index"))); 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); countRequest.listenerThreaded(false);
try { try {
BroadcastOperationThreading operationThreading = BroadcastOperationThreading.fromString(request.param("operation_threading"), BroadcastOperationThreading.SINGLE_THREAD); BroadcastOperationThreading operationThreading = BroadcastOperationThreading.fromString(request.param("operation_threading"), BroadcastOperationThreading.SINGLE_THREAD);

View File

@ -61,7 +61,10 @@ public class RestMultiSearchAction extends BaseRestHandler {
String[] indices = RestActions.splitIndices(request.param("index")); String[] indices = RestActions.splitIndices(request.param("index"));
String[] types = RestActions.splitTypes(request.param("type")); 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 { try {
multiSearchRequest.add(request.content(), request.contentUnsafe(), indices, types, request.param("search_type"), ignoreIndices); multiSearchRequest.add(request.content(), request.contentUnsafe(), indices, types, request.param("search_type"), ignoreIndices);

View File

@ -142,7 +142,9 @@ public class RestSearchAction extends BaseRestHandler {
searchRequest.queryHint(request.param("query_hint")); searchRequest.queryHint(request.param("query_hint"));
searchRequest.routing(request.param("routing")); searchRequest.routing(request.param("routing"));
searchRequest.preference(request.param("preference")); 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; return searchRequest;
} }