Skip to content

Commit

Permalink
Leftover from #35964 (#36030)
Browse files Browse the repository at this point in the history
  • Loading branch information
astefan authored Nov 29, 2018
1 parent 89c5151 commit 525c3b0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ public final class Protocol {
public static final String CLEAR_CURSOR_DEPRECATED_REST_ENDPOINT = "/_xpack/sql/close";
public static final String SQL_QUERY_REST_ENDPOINT = "/_sql";
public static final String SQL_QUERY_DEPRECATED_REST_ENDPOINT = "/_xpack/sql";
public static final String SQL_TRANSLATE_REST_ENDPOINT = "/_sql/translate";
public static final String SQL_TRANSLATE_DEPRECATED_REST_ENDPOINT = "/_xpack/sql/translate";
public static final String SQL_STATS_REST_ENDPOINT = "/_sql/stats";
public static final String SQL_STATS_DEPRECATED_REST_ENDPOINT = "/_xpack/sql/stats";
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -15,6 +17,7 @@
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;

Expand All @@ -25,10 +28,19 @@
* 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
Expand Down

0 comments on commit 525c3b0

Please sign in to comment.