|
@@ -5,7 +5,9 @@
|
|
|
*/
|
|
|
package org.elasticsearch.xpack.sql.plugin;
|
|
|
|
|
|
+import org.apache.logging.log4j.LogManager;
|
|
|
import org.elasticsearch.client.node.NodeClient;
|
|
|
+import org.elasticsearch.common.logging.DeprecationLogger;
|
|
|
import org.elasticsearch.common.settings.Settings;
|
|
|
import org.elasticsearch.common.xcontent.XContentParser;
|
|
|
import org.elasticsearch.rest.BaseRestHandler;
|
|
@@ -15,6 +17,7 @@ import org.elasticsearch.rest.action.RestToXContentListener;
|
|
|
import org.elasticsearch.xpack.sql.action.SqlTranslateAction;
|
|
|
import org.elasticsearch.xpack.sql.action.SqlTranslateRequest;
|
|
|
import org.elasticsearch.xpack.sql.proto.Mode;
|
|
|
+import org.elasticsearch.xpack.sql.proto.Protocol;
|
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
@@ -25,10 +28,19 @@ import static org.elasticsearch.rest.RestRequest.Method.POST;
|
|
|
* REST action for translating SQL queries into ES requests
|
|
|
*/
|
|
|
public class RestSqlTranslateAction extends BaseRestHandler {
|
|
|
+
|
|
|
+ private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestSqlTranslateAction.class));
|
|
|
+
|
|
|
public RestSqlTranslateAction(Settings settings, RestController controller) {
|
|
|
super(settings);
|
|
|
- controller.registerHandler(GET, "/_sql/translate", this);
|
|
|
- controller.registerHandler(POST, "/_sql/translate", this);
|
|
|
+ // TODO: remove deprecated endpoint in 8.0.0
|
|
|
+ controller.registerWithDeprecatedHandler(
|
|
|
+ GET, Protocol.SQL_TRANSLATE_REST_ENDPOINT, this,
|
|
|
+ GET, Protocol.SQL_TRANSLATE_DEPRECATED_REST_ENDPOINT, deprecationLogger);
|
|
|
+ // TODO: remove deprecated endpoint in 8.0.0
|
|
|
+ controller.registerWithDeprecatedHandler(
|
|
|
+ POST, Protocol.SQL_TRANSLATE_REST_ENDPOINT, this,
|
|
|
+ POST, Protocol.SQL_TRANSLATE_DEPRECATED_REST_ENDPOINT, deprecationLogger);
|
|
|
}
|
|
|
|
|
|
@Override
|