|
@@ -19,6 +19,7 @@
|
|
|
|
|
|
package org.elasticsearch.rest.action.admin.indices;
|
|
package org.elasticsearch.rest.action.admin.indices;
|
|
|
|
|
|
|
|
+import org.apache.logging.log4j.LogManager;
|
|
import org.elasticsearch.action.admin.indices.validate.query.QueryExplanation;
|
|
import org.elasticsearch.action.admin.indices.validate.query.QueryExplanation;
|
|
import org.elasticsearch.action.admin.indices.validate.query.ValidateQueryRequest;
|
|
import org.elasticsearch.action.admin.indices.validate.query.ValidateQueryRequest;
|
|
import org.elasticsearch.action.admin.indices.validate.query.ValidateQueryResponse;
|
|
import org.elasticsearch.action.admin.indices.validate.query.ValidateQueryResponse;
|
|
@@ -26,6 +27,7 @@ import org.elasticsearch.action.support.IndicesOptions;
|
|
import org.elasticsearch.client.node.NodeClient;
|
|
import org.elasticsearch.client.node.NodeClient;
|
|
import org.elasticsearch.common.ParsingException;
|
|
import org.elasticsearch.common.ParsingException;
|
|
import org.elasticsearch.common.Strings;
|
|
import org.elasticsearch.common.Strings;
|
|
|
|
+import org.elasticsearch.common.logging.DeprecationLogger;
|
|
import org.elasticsearch.common.settings.Settings;
|
|
import org.elasticsearch.common.settings.Settings;
|
|
import org.elasticsearch.common.xcontent.XContentBuilder;
|
|
import org.elasticsearch.common.xcontent.XContentBuilder;
|
|
import org.elasticsearch.rest.BaseRestHandler;
|
|
import org.elasticsearch.rest.BaseRestHandler;
|
|
@@ -43,6 +45,11 @@ import static org.elasticsearch.rest.RestRequest.Method.POST;
|
|
import static org.elasticsearch.rest.RestStatus.OK;
|
|
import static org.elasticsearch.rest.RestStatus.OK;
|
|
|
|
|
|
public class RestValidateQueryAction extends BaseRestHandler {
|
|
public class RestValidateQueryAction extends BaseRestHandler {
|
|
|
|
+ private static final DeprecationLogger deprecationLogger = new DeprecationLogger(
|
|
|
|
+ LogManager.getLogger(RestValidateQueryAction.class));
|
|
|
|
+ static final String TYPES_DEPRECATION_MESSAGE = "[types removal]" +
|
|
|
|
+ " Specifying types in validate query requests is deprecated.";
|
|
|
|
+
|
|
public RestValidateQueryAction(Settings settings, RestController controller) {
|
|
public RestValidateQueryAction(Settings settings, RestController controller) {
|
|
super(settings);
|
|
super(settings);
|
|
controller.registerHandler(GET, "/_validate/query", this);
|
|
controller.registerHandler(GET, "/_validate/query", this);
|
|
@@ -63,7 +70,12 @@ public class RestValidateQueryAction extends BaseRestHandler {
|
|
ValidateQueryRequest validateQueryRequest = new ValidateQueryRequest(Strings.splitStringByCommaToArray(request.param("index")));
|
|
ValidateQueryRequest validateQueryRequest = new ValidateQueryRequest(Strings.splitStringByCommaToArray(request.param("index")));
|
|
validateQueryRequest.indicesOptions(IndicesOptions.fromRequest(request, validateQueryRequest.indicesOptions()));
|
|
validateQueryRequest.indicesOptions(IndicesOptions.fromRequest(request, validateQueryRequest.indicesOptions()));
|
|
validateQueryRequest.explain(request.paramAsBoolean("explain", false));
|
|
validateQueryRequest.explain(request.paramAsBoolean("explain", false));
|
|
- validateQueryRequest.types(Strings.splitStringByCommaToArray(request.param("type")));
|
|
|
|
|
|
+
|
|
|
|
+ if (request.hasParam("type")) {
|
|
|
|
+ deprecationLogger.deprecated(TYPES_DEPRECATION_MESSAGE);
|
|
|
|
+ validateQueryRequest.types(Strings.splitStringByCommaToArray(request.param("type")));
|
|
|
|
+ }
|
|
|
|
+
|
|
validateQueryRequest.rewrite(request.paramAsBoolean("rewrite", false));
|
|
validateQueryRequest.rewrite(request.paramAsBoolean("rewrite", false));
|
|
validateQueryRequest.allShards(request.paramAsBoolean("all_shards", false));
|
|
validateQueryRequest.allShards(request.paramAsBoolean("all_shards", false));
|
|
|
|
|