From 2c47f76d8ce61acfb70e73553a9017a25a08280f Mon Sep 17 00:00:00 2001 From: Chen Dai Date: Tue, 18 May 2021 11:44:18 -0700 Subject: [PATCH 1/3] Replace SQL endpoints Signed-off-by: Chen Dai --- .../sql/legacy/plugin/RestSqlAction.java | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/legacy/src/main/java/org/opensearch/sql/legacy/plugin/RestSqlAction.java b/legacy/src/main/java/org/opensearch/sql/legacy/plugin/RestSqlAction.java index f75bbb38993..d591fd3d5a5 100644 --- a/legacy/src/main/java/org/opensearch/sql/legacy/plugin/RestSqlAction.java +++ b/legacy/src/main/java/org/opensearch/sql/legacy/plugin/RestSqlAction.java @@ -121,13 +121,21 @@ public RestSqlAction(Settings settings, ClusterService clusterService, @Override public List routes() { + return ImmutableList.of(); + } + + @Override + public List replacedRoutes() { return ImmutableList.of( - new Route(RestRequest.Method.POST, QUERY_API_ENDPOINT), - new Route(RestRequest.Method.POST, EXPLAIN_API_ENDPOINT), - new Route(RestRequest.Method.POST, CURSOR_CLOSE_ENDPOINT), - new Route(RestRequest.Method.POST, LEGACY_QUERY_API_ENDPOINT), - new Route(RestRequest.Method.POST, LEGACY_EXPLAIN_API_ENDPOINT), - new Route(RestRequest.Method.POST, LEGACY_CURSOR_CLOSE_ENDPOINT) + new ReplacedRoute( + RestRequest.Method.POST, QUERY_API_ENDPOINT, + RestRequest.Method.POST, LEGACY_QUERY_API_ENDPOINT), + new ReplacedRoute( + RestRequest.Method.POST, EXPLAIN_API_ENDPOINT, + RestRequest.Method.POST, LEGACY_EXPLAIN_API_ENDPOINT), + new ReplacedRoute( + RestRequest.Method.POST, CURSOR_CLOSE_ENDPOINT, + RestRequest.Method.POST, LEGACY_CURSOR_CLOSE_ENDPOINT) ); } From 6813597d8c1c53938e013041aa8c9c4cdbb2ff51 Mon Sep 17 00:00:00 2001 From: Chen Dai Date: Tue, 18 May 2021 13:40:08 -0700 Subject: [PATCH 2/3] Replace other SQL and PPL endpoints Signed-off-by: Chen Dai --- .../sql/legacy/plugin/RestSqlAction.java | 3 +-- .../legacy/plugin/RestSqlSettingsAction.java | 11 ++++++++--- .../sql/legacy/plugin/RestSqlStatsAction.java | 16 +++++++++++----- .../sql/plugin/rest/RestPPLQueryAction.java | 17 ++++++++++++----- .../sql/plugin/rest/RestPPLStatsAction.java | 16 +++++++++++----- 5 files changed, 43 insertions(+), 20 deletions(-) diff --git a/legacy/src/main/java/org/opensearch/sql/legacy/plugin/RestSqlAction.java b/legacy/src/main/java/org/opensearch/sql/legacy/plugin/RestSqlAction.java index d591fd3d5a5..0a3cdd4c684 100644 --- a/legacy/src/main/java/org/opensearch/sql/legacy/plugin/RestSqlAction.java +++ b/legacy/src/main/java/org/opensearch/sql/legacy/plugin/RestSqlAction.java @@ -135,8 +135,7 @@ public List replacedRoutes() { RestRequest.Method.POST, LEGACY_EXPLAIN_API_ENDPOINT), new ReplacedRoute( RestRequest.Method.POST, CURSOR_CLOSE_ENDPOINT, - RestRequest.Method.POST, LEGACY_CURSOR_CLOSE_ENDPOINT) - ); + RestRequest.Method.POST, LEGACY_CURSOR_CLOSE_ENDPOINT)); } @Override diff --git a/legacy/src/main/java/org/opensearch/sql/legacy/plugin/RestSqlSettingsAction.java b/legacy/src/main/java/org/opensearch/sql/legacy/plugin/RestSqlSettingsAction.java index 52690e74937..e2959e6a5ac 100644 --- a/legacy/src/main/java/org/opensearch/sql/legacy/plugin/RestSqlSettingsAction.java +++ b/legacy/src/main/java/org/opensearch/sql/legacy/plugin/RestSqlSettingsAction.java @@ -84,10 +84,15 @@ public String getName() { @Override public List routes() { + return ImmutableList.of(); + } + + @Override + public List replacedRoutes() { return ImmutableList.of( - new Route(RestRequest.Method.PUT, SETTINGS_API_ENDPOINT), - new Route(RestRequest.Method.PUT, LEGACY_SETTINGS_API_ENDPOINT) - ); + new ReplacedRoute( + RestRequest.Method.PUT, SETTINGS_API_ENDPOINT, + RestRequest.Method.PUT, LEGACY_SETTINGS_API_ENDPOINT)); } /** diff --git a/legacy/src/main/java/org/opensearch/sql/legacy/plugin/RestSqlStatsAction.java b/legacy/src/main/java/org/opensearch/sql/legacy/plugin/RestSqlStatsAction.java index 609960e6194..d9769155d59 100644 --- a/legacy/src/main/java/org/opensearch/sql/legacy/plugin/RestSqlStatsAction.java +++ b/legacy/src/main/java/org/opensearch/sql/legacy/plugin/RestSqlStatsAction.java @@ -70,12 +70,18 @@ public String getName() { @Override public List routes() { + return ImmutableList.of(); + } + + @Override + public List replacedRoutes() { return ImmutableList.of( - new Route(RestRequest.Method.POST, STATS_API_ENDPOINT), - new Route(RestRequest.Method.GET, STATS_API_ENDPOINT), - new Route(RestRequest.Method.POST, LEGACY_STATS_API_ENDPOINT), - new Route(RestRequest.Method.GET, LEGACY_STATS_API_ENDPOINT) - ); + new ReplacedRoute( + RestRequest.Method.POST, STATS_API_ENDPOINT, + RestRequest.Method.POST, LEGACY_STATS_API_ENDPOINT), + new ReplacedRoute( + RestRequest.Method.GET, STATS_API_ENDPOINT, + RestRequest.Method.GET, LEGACY_STATS_API_ENDPOINT)); } @Override diff --git a/plugin/src/main/java/org/opensearch/sql/plugin/rest/RestPPLQueryAction.java b/plugin/src/main/java/org/opensearch/sql/plugin/rest/RestPPLQueryAction.java index 2fb90f324ea..a08f9dfdad9 100644 --- a/plugin/src/main/java/org/opensearch/sql/plugin/rest/RestPPLQueryAction.java +++ b/plugin/src/main/java/org/opensearch/sql/plugin/rest/RestPPLQueryAction.java @@ -32,6 +32,7 @@ import static org.opensearch.rest.RestStatus.SERVICE_UNAVAILABLE; import static org.opensearch.sql.protocol.response.format.JsonResponseFormatter.Style.PRETTY; +import com.google.common.collect.ImmutableList; import java.io.IOException; import java.security.PrivilegedExceptionAction; import java.util.Arrays; @@ -114,12 +115,18 @@ public RestPPLQueryAction(RestController restController, ClusterService clusterS @Override public List routes() { + return ImmutableList.of(); + } + + @Override + public List replacedRoutes() { return Arrays.asList( - new Route(RestRequest.Method.POST, QUERY_API_ENDPOINT), - new Route(RestRequest.Method.POST, EXPLAIN_API_ENDPOINT), - new Route(RestRequest.Method.POST, LEGACY_QUERY_API_ENDPOINT), - new Route(RestRequest.Method.POST, LEGACY_EXPLAIN_API_ENDPOINT) - ); + new ReplacedRoute( + RestRequest.Method.POST, QUERY_API_ENDPOINT, + RestRequest.Method.POST, LEGACY_QUERY_API_ENDPOINT), + new ReplacedRoute( + RestRequest.Method.POST, EXPLAIN_API_ENDPOINT, + RestRequest.Method.POST, LEGACY_EXPLAIN_API_ENDPOINT)); } @Override diff --git a/plugin/src/main/java/org/opensearch/sql/plugin/rest/RestPPLStatsAction.java b/plugin/src/main/java/org/opensearch/sql/plugin/rest/RestPPLStatsAction.java index ef34b9a86c8..9ca7cb76af0 100644 --- a/plugin/src/main/java/org/opensearch/sql/plugin/rest/RestPPLStatsAction.java +++ b/plugin/src/main/java/org/opensearch/sql/plugin/rest/RestPPLStatsAction.java @@ -72,12 +72,18 @@ public String getName() { @Override public List routes() { + return ImmutableList.of(); + } + + @Override + public List replacedRoutes() { return ImmutableList.of( - new Route(RestRequest.Method.POST, PPL_STATS_API_ENDPOINT), - new Route(RestRequest.Method.GET, PPL_STATS_API_ENDPOINT), - new Route(RestRequest.Method.POST, PPL_LEGACY_STATS_API_ENDPOINT), - new Route(RestRequest.Method.GET, PPL_LEGACY_STATS_API_ENDPOINT) - ); + new ReplacedRoute( + RestRequest.Method.POST, PPL_STATS_API_ENDPOINT, + RestRequest.Method.POST, PPL_LEGACY_STATS_API_ENDPOINT), + new ReplacedRoute( + RestRequest.Method.GET, PPL_STATS_API_ENDPOINT, + RestRequest.Method.GET, PPL_LEGACY_STATS_API_ENDPOINT)); } @Override From 3a6e91ec05f953657a2e546e4a9a023f177b0720 Mon Sep 17 00:00:00 2001 From: Chen Dai Date: Tue, 18 May 2021 14:08:52 -0700 Subject: [PATCH 3/3] Move all endpoints to _plugins Signed-off-by: Chen Dai --- README.md | 8 ++--- docs/dev/Doctest.md | 4 +-- docs/dev/Pagination.md | 6 ++-- docs/dev/SemanticAnalysis.md | 14 ++++---- docs/experiment/ppl/admin/monitoring.rst | 2 +- docs/experiment/ppl/admin/settings.rst | 4 +-- docs/experiment/ppl/interfaces/endpoint.rst | 8 ++--- docs/experiment/ppl/interfaces/protocol.rst | 6 ++-- docs/user/admin/monitoring.rst | 2 +- docs/user/admin/settings.rst | 26 +++++++------- docs/user/beyond/fulltext.rst | 12 +++---- docs/user/beyond/partiql.rst | 4 +-- docs/user/dml/delete.rst | 2 +- docs/user/dql/basics.rst | 36 +++++++++---------- docs/user/dql/complex.rst | 10 +++--- docs/user/dql/metadata.rst | 6 ++-- docs/user/dql/newsql.rst | 2 +- docs/user/dql/troubleshooting.rst | 6 ++-- docs/user/interfaces/endpoint.rst | 6 ++-- docs/user/interfaces/protocol.rst | 20 +++++------ docs/user/limitations/limitations.rst | 2 +- docs/user/optimization/optimization.rst | 24 ++++++------- .../sql/doctest/core/test/DocBuilderTest.java | 4 +-- .../core/test/SqlRequestFormatTest.java | 8 ++--- .../sql/legacy/CsvFormatResponseIT.java | 2 +- .../sql/legacy/PrettyFormatterIT.java | 2 +- .../sql/legacy/QueryAnalysisIT.java | 2 +- .../sql/legacy/SQLIntegTestCase.java | 6 ++-- .../org/opensearch/sql/ppl/MetricsIT.java | 2 +- .../org/opensearch/sql/ppl/PPLPluginIT.java | 2 +- .../sql/legacy/plugin/RestSqlAction.java | 2 +- .../legacy/plugin/RestSqlSettingsAction.java | 2 +- .../sql/legacy/plugin/RestSqlStatsAction.java | 2 +- .../sql/plugin/rest/RestPPLQueryAction.java | 4 +-- .../sql/plugin/rest/RestPPLStatsAction.java | 2 +- .../opensearch/sql/ppl/PPLServiceTest.java | 2 +- .../sql/ppl/domain/PPLQueryRequestTest.java | 10 +++--- .../opensearch_connection.py | 4 +-- .../jdbc/protocol/http/JsonHttpProtocol.java | 2 +- .../odfesqlodbc/opensearch_communication.cpp | 4 +-- .../opensearch/sql/sql/SQLServiceTest.java | 6 ++-- .../sql/sql/domain/SQLQueryRequestTest.java | 4 +-- workbench/server/services/utils/constants.ts | 8 ++--- 43 files changed, 145 insertions(+), 145 deletions(-) diff --git a/README.md b/README.md index d6097cdb9dc..d9ece477177 100644 --- a/README.md +++ b/README.md @@ -48,12 +48,12 @@ The package uses the [Gradle](https://docs.gradle.org/4.10.2/userguide/userguide ## Basic Usage -To use the feature, send requests to the `_opensearch/_sql` URI. You can use a request parameter or the request body (recommended). Note that for backward compatibility, old `_opendistro/_sql` endpoint is still available, though any future API will be only accessible by new OpenSearch endpoint. +To use the feature, send requests to the `_plugins/_sql` URI. You can use a request parameter or the request body (recommended). Note that for backward compatibility, old `_opendistro/_sql` endpoint is still available, though any future API will be only accessible by new OpenSearch endpoint. * Simple query ``` -POST https://:/_opensearch/_sql +POST https://:/_plugins/_sql { "query": "SELECT * FROM my-index LIMIT 50" } @@ -61,7 +61,7 @@ POST https://:/_opensearch/_sql * Explain SQL to OpenSearch query DSL ``` -POST _opensearch/_sql/_explain +POST _plugins/_sql/_explain { "query": "SELECT * FROM my-index LIMIT 50" } @@ -69,7 +69,7 @@ POST _opensearch/_sql/_explain * For a sample curl command with the OpenSearch Security plugin, try: ``` -curl -XPOST https://localhost:9200/_opensearch/_sql -u admin:admin -k -d '{"query": "SELECT * FROM my-index LIMIT 10"}' -H 'Content-Type: application/json' +curl -XPOST https://localhost:9200/_plugins/_sql -u admin:admin -k -d '{"query": "SELECT * FROM my-index LIMIT 10"}' -H 'Content-Type: application/json' ``` diff --git a/docs/dev/Doctest.md b/docs/dev/Doctest.md index 71993f76a3b..f02699b6a63 100644 --- a/docs/dev/Doctest.md +++ b/docs/dev/Doctest.md @@ -175,7 +175,7 @@ fetched rows / total rows = 4/4 The code example in a doc using `bash` should be like this ``` -sh$ curl -XPOST "localhost:9200/_opensearch/_ppl/" +sh$ curl -XPOST "localhost:9200/_plugins/_ppl/" -H 'Content-Type: application/json' -d'{ "query": "search source=opensearch_dashboards_sample_data_flights OriginCountry = "IT" DestiContry = "US" | fields FlightNum, DestCountry, OriginCountry "}' @@ -229,7 +229,7 @@ Doctest: explain.rst File "/Users/szhongna/Desktop/Projects/sql/doctest/docs/dql/explain.rst", line 6, in explain.rst Failed example: pretty_print(sh("""curl -sS -H 'Content-Type: application/json' \ - -X POST localhost:9200/_opensearch/_sql/_explain \ + -X POST localhost:9200/_plugins/_sql/_explain \ -d '{"query" : "SELECT firstname, lastname FROM accounts WHERE age > 20"}' """).stdout.decode("utf-8")) Expected: diff --git a/docs/dev/Pagination.md b/docs/dev/Pagination.md index 82f654170f7..c2d1fc24cee 100644 --- a/docs/dev/Pagination.md +++ b/docs/dev/Pagination.md @@ -101,7 +101,7 @@ Since we are implementing server side cursors, either OpenSearch SQL plugin or O ``` # 1.Creates a cursor -POST _opensearch/_sql?format=jdbc +POST _plugins/_sql?format=jdbc { "query": "SELECT * FROM accounts", "fetch_size": 5 @@ -118,7 +118,7 @@ POST _opensearch/_sql?format=jdbc } # 2.Fetch next page by cursor provided in previous response -POST _opensearch/_sql?format=jdbc +POST _plugins/_sql?format=jdbc { "cursor": "cursorId" } @@ -135,7 +135,7 @@ POST _opensearch/_sql?format=jdbc # 4.Clear the state forcibly earlier than last page be reached -POST _opensearch/_sql/close +POST _plugins/_sql/close { "cursor": "cursorId" } diff --git a/docs/dev/SemanticAnalysis.md b/docs/dev/SemanticAnalysis.md index c093b8abcc2..1682c945977 100644 --- a/docs/dev/SemanticAnalysis.md +++ b/docs/dev/SemanticAnalysis.md @@ -23,7 +23,7 @@ Firstly, you could go through the following examples of semantic check with our ### 2.1 Field Name Typo ``` -POST _opensearch/_sql +POST _plugins/_sql { "query": "SELECT balace FROM accounts" } @@ -41,7 +41,7 @@ POST _opensearch/_sql ### 2.2 Function Call on Incompatible Field Type ``` -POST _opensearch/_sql +POST _plugins/_sql { "query": "SELECT * FROM accounts WHERE SUBSTRING(balance, 0, 1) = 'test'" } @@ -59,7 +59,7 @@ POST _opensearch/_sql ### 2.3 An index Join Non-nested Field ``` -POST _opensearch/_sql +POST _plugins/_sql { "query": "SELECT * FROM accounts a, a.firstname" } @@ -77,7 +77,7 @@ POST _opensearch/_sql ### 2.4 Wrong Reference in Subquery ``` -POST _opensearch/_sql +POST _plugins/_sql { "query": "SELECT * FROM accounts a WHERE EXISTS (SELECT * FROM accounts b WHERE b.address LIKE 'Seattle') AND b.age > 10" } @@ -95,7 +95,7 @@ POST _opensearch/_sql ### 2.5 Operator Use on Incompatible Field Type ``` -POST _opensearch/_sql +POST _plugins/_sql { "query": "SELECT * FROM accounts WHERE lastname IS FALSE" } @@ -113,7 +113,7 @@ POST _opensearch/_sql ### 2.6 Subquery Return Incompatible Type ``` -POST _opensearch/_sql +POST _plugins/_sql { "query": "SELECT * FROM accounts WHERE lastname IN (SELECT age FROM accounts)" } @@ -131,7 +131,7 @@ POST _opensearch/_sql ### 2.7 Multi-query On Incompatible Type ``` -POST _opensearch/_sql +POST _plugins/_sql { "query": "SELECT balance FROM accounts UNION ALL SELECT city FROM accounts" } diff --git a/docs/experiment/ppl/admin/monitoring.rst b/docs/experiment/ppl/admin/monitoring.rst index 454885e1df7..625b0411c49 100644 --- a/docs/experiment/ppl/admin/monitoring.rst +++ b/docs/experiment/ppl/admin/monitoring.rst @@ -42,7 +42,7 @@ Example SQL query:: - >> curl -H 'Content-Type: application/json' -X GET localhost:9200/_opensearch/_ppl/stats + >> curl -H 'Content-Type: application/json' -X GET localhost:9200/_plugins/_ppl/stats Result set:: diff --git a/docs/experiment/ppl/admin/settings.rst b/docs/experiment/ppl/admin/settings.rst index 588ddd5d59a..c0c8561f33b 100644 --- a/docs/experiment/ppl/admin/settings.rst +++ b/docs/experiment/ppl/admin/settings.rst @@ -28,7 +28,7 @@ You can disable SQL plugin to reject all coming requests. 2. This setting is node scope. 3. This setting can be updated dynamically. -Notes. Calls to _opensearch/_ppl include index names in the request body, so they have the same access policy considerations as the bulk, mget, and msearch operations. if rest.action.multi.allow_explicit_index set to false, PPL plugin will be disabled. +Notes. Calls to _plugins/_ppl include index names in the request body, so they have the same access policy considerations as the bulk, mget, and msearch operations. if rest.action.multi.allow_explicit_index set to false, PPL plugin will be disabled. Example 1 --------- @@ -60,7 +60,7 @@ Query result after the setting updated is like: PPL query:: sh$ curl -sS -H 'Content-Type: application/json' \ - ... -X POST localhost:9200/_opensearch/_ppl \ + ... -X POST localhost:9200/_plugins/_ppl \ { "error": { "reason": "Invalid Query", diff --git a/docs/experiment/ppl/interfaces/endpoint.rst b/docs/experiment/ppl/interfaces/endpoint.rst index 5177bedf422..fb64eff6883 100644 --- a/docs/experiment/ppl/interfaces/endpoint.rst +++ b/docs/experiment/ppl/interfaces/endpoint.rst @@ -22,7 +22,7 @@ POST Description ----------- -You can send HTTP POST request to endpoint **/_opensearch/_ppl** with your query in request body. +You can send HTTP POST request to endpoint **/_plugins/_ppl** with your query in request body. Example ------- @@ -30,7 +30,7 @@ Example PPL query:: sh$ curl -sS -H 'Content-Type: application/json' \ - ... -X POST localhost:9200/_opensearch/_ppl \ + ... -X POST localhost:9200/_plugins/_ppl \ ... -d '{"query" : "source=accounts | fields firstname, lastname"}' { "schema": [ @@ -71,7 +71,7 @@ Explain Description ----------- -You can send HTTP explain request to endpoint **/_opensearch/_ppl/_explain** with your query in request body to understand the execution plan for the PPL query. The explain endpoint is useful when user want to get insight how the query is executed in the engine. +You can send HTTP explain request to endpoint **/_plugins/_ppl/_explain** with your query in request body to understand the execution plan for the PPL query. The explain endpoint is useful when user want to get insight how the query is executed in the engine. Example ------- @@ -79,7 +79,7 @@ Example The following PPL query demonstrated that where and stats command were pushed down to OpenSearch DSL aggregation query:: sh$ curl -sS -H 'Content-Type: application/json' \ - ... -X POST localhost:9200/_opensearch/_ppl/_explain \ + ... -X POST localhost:9200/_plugins/_ppl/_explain \ ... -d '{"query" : "source=accounts | where age > 10 | stats avg(age)"}' { "root": { diff --git a/docs/experiment/ppl/interfaces/protocol.rst b/docs/experiment/ppl/interfaces/protocol.rst index ec58ae56ddc..d3706e7f206 100644 --- a/docs/experiment/ppl/interfaces/protocol.rst +++ b/docs/experiment/ppl/interfaces/protocol.rst @@ -30,7 +30,7 @@ Example 1 PPL query:: sh$ curl -sS -H 'Content-Type: application/json' \ - ... -X POST localhost:9200/_opensearch/_ppl \ + ... -X POST localhost:9200/_plugins/_ppl \ ... -d '{"query" : "source=accounts | fields firstname, lastname"}' { "schema": [ @@ -81,7 +81,7 @@ Here is an example for normal response. The `schema` includes field name and its PPL query:: sh$ curl -sS -H 'Content-Type: application/json' \ - ... -X POST localhost:9200/_opensearch/_ppl \ + ... -X POST localhost:9200/_plugins/_ppl \ ... -d '{"query" : "source=accounts | fields firstname, lastname"}' { "schema": [ @@ -124,7 +124,7 @@ If any error occurred, error message and the cause will be returned instead. PPL query:: sh$ curl -sS -H 'Content-Type: application/json' \ - ... -X POST localhost:9200/_opensearch/_ppl \ + ... -X POST localhost:9200/_plugins/_ppl \ ... -d '{"query" : "source=unknown | fields firstname, lastname"}' { "error": { diff --git a/docs/user/admin/monitoring.rst b/docs/user/admin/monitoring.rst index f27b7ab998d..c6f005332c2 100644 --- a/docs/user/admin/monitoring.rst +++ b/docs/user/admin/monitoring.rst @@ -48,7 +48,7 @@ Example SQL query:: - >> curl -H 'Content-Type: application/json' -X GET localhost:9200/_opensearch/_sql/stats + >> curl -H 'Content-Type: application/json' -X GET localhost:9200/_plugins/_sql/stats Result set:: diff --git a/docs/user/admin/settings.rst b/docs/user/admin/settings.rst index bd82e57126c..1bf683d85c8 100644 --- a/docs/user/admin/settings.rst +++ b/docs/user/admin/settings.rst @@ -37,7 +37,7 @@ You can update the setting with a new value like this. SQL query:: - >> curl -H 'Content-Type: application/json' -X PUT localhost:9200/_opensearch/_sql/settings -d '{ + >> curl -H 'Content-Type: application/json' -X PUT localhost:9200/_plugins/_sql/settings -d '{ "transient" : { "opensearch.sql.enabled" : "false" } @@ -64,7 +64,7 @@ Query result after the setting updated is like: SQL query:: - >> curl -H 'Content-Type: application/json' -X POST localhost:9200/_opensearch/_sql -d '{ + >> curl -H 'Content-Type: application/json' -X POST localhost:9200/_plugins/_sql -d '{ "query" : "SELECT * FROM accounts" }' @@ -99,7 +99,7 @@ You can update the setting with a new value like this. SQL query:: - >> curl -H 'Content-Type: application/json' -X PUT localhost:9200/_opensearch/_sql/settings -d '{ + >> curl -H 'Content-Type: application/json' -X PUT localhost:9200/_plugins/_sql/settings -d '{ "transient" : { "opensearch.sql.query.slowlog" : "10" } @@ -141,7 +141,7 @@ You can update the setting with a new value like this. SQL query:: - >> curl -H 'Content-Type: application/json' -X PUT localhost:9200/_opensearch/_sql/settings -d '{ + >> curl -H 'Content-Type: application/json' -X PUT localhost:9200/_plugins/_sql/settings -d '{ "transient" : { "opensearch.sql.query.analysis.enabled" : "false" } @@ -185,7 +185,7 @@ You can update the setting with a new value like this. SQL query:: - >> curl -H 'Content-Type: application/json' -X PUT localhost:9200/_opensearch/_sql/settings -d '{ + >> curl -H 'Content-Type: application/json' -X PUT localhost:9200/_plugins/_sql/settings -d '{ "transient" : { "opensearch.sql.query.analysis.semantic.suggestion" : "true" } @@ -218,7 +218,7 @@ Query result after the setting updated is like: SQL query:: - >> curl -H 'Content-Type: application/json' -X POST localhost:9200/_opensearch/_sql -d '{ + >> curl -H 'Content-Type: application/json' -X POST localhost:9200/_plugins/_sql -d '{ "query" : "SELECT first FROM accounts" }' @@ -253,7 +253,7 @@ You can update the setting with a new value like this. SQL query:: - >> curl -H 'Content-Type: application/json' -X PUT localhost:9200/_opensearch/_sql/settings -d '{ + >> curl -H 'Content-Type: application/json' -X PUT localhost:9200/_plugins/_sql/settings -d '{ "transient" : { "opensearch.sql.query.analysis.semantic.threshold" : "50" } @@ -299,7 +299,7 @@ You can update the setting with a new value like this. SQL query:: - >> curl -H 'Content-Type: application/json' -X PUT localhost:9200/_opensearch/_sql/settings -d '{ + >> curl -H 'Content-Type: application/json' -X PUT localhost:9200/_plugins/_sql/settings -d '{ "transient" : { "opensearch.sql.query.response.format" : "json" } @@ -330,7 +330,7 @@ Query result after the setting updated is like: SQL query:: - >> curl -H 'Content-Type: application/json' -X POST localhost:9200/_opensearch/_sql -d '{ + >> curl -H 'Content-Type: application/json' -X POST localhost:9200/_plugins/_sql -d '{ "query" : "SELECT firstname, lastname, age FROM accounts ORDER BY age LIMIT 2" }' @@ -404,7 +404,7 @@ You can update the setting with a new value like this. SQL query:: - >> curl -H 'Content-Type: application/json' -X PUT localhost:9200/_opensearch/_sql/settings -d '{ + >> curl -H 'Content-Type: application/json' -X PUT localhost:9200/_plugins/_sql/settings -d '{ "transient" : { "opensearch.sql.cursor.enabled" : "true" } @@ -446,7 +446,7 @@ You can update the setting with a new value like this. SQL query:: - >> curl -H 'Content-Type: application/json' -X PUT localhost:9200/_opensearch/_sql/settings -d '{ + >> curl -H 'Content-Type: application/json' -X PUT localhost:9200/_plugins/_sql/settings -d '{ "transient" : { "opensearch.sql.cursor.fetch_size" : "50" } @@ -488,7 +488,7 @@ You can update the setting with a new value like this. SQL query:: - >> curl -H 'Content-Type: application/json' -X PUT localhost:9200/_opensearch/_sql/settings -d '{ + >> curl -H 'Content-Type: application/json' -X PUT localhost:9200/_plugins/_sql/settings -d '{ "transient" : { "opensearch.sql.cursor.keep_alive" : "5m" } @@ -530,7 +530,7 @@ You can update the setting with a new value like this. SQL query:: - >> curl -H 'Content-Type: application/json' -X PUT localhost:9200/_opensearch/_sql/settings -d '{ + >> curl -H 'Content-Type: application/json' -X PUT localhost:9200/_plugins/_sql/settings -d '{ "transient" : { "opensearch.sql.engine.new.enabled" : "false" } diff --git a/docs/user/beyond/fulltext.rst b/docs/user/beyond/fulltext.rst index c33e5445a15..c2edbfa97d6 100644 --- a/docs/user/beyond/fulltext.rst +++ b/docs/user/beyond/fulltext.rst @@ -29,7 +29,7 @@ Both functions can accept field name as first argument and a text as second argu SQL query:: - POST /_opensearch/_sql + POST /_plugins/_sql { "query" : """ SELECT account_number, address @@ -99,7 +99,7 @@ Both functions can also accept single argument and be used in the following mann SQL query:: - POST /_opensearch/_sql + POST /_plugins/_sql { "query" : """ SELECT account_number, address @@ -177,7 +177,7 @@ Each preceding function accepts ``query`` for a text and ``fields`` for field na SQL query:: - POST /_opensearch/_sql + POST /_plugins/_sql { "query" : """ SELECT firstname, lastname @@ -257,7 +257,7 @@ Example SQL query:: - POST /_opensearch/_sql + POST /_plugins/_sql { "query" : """ SELECT account_number, address @@ -340,7 +340,7 @@ Example SQL query:: - POST /_opensearch/_sql + POST /_plugins/_sql { "query" : """ SELECT account_number, address @@ -413,7 +413,7 @@ The first argument is a match query expression and the second argument is for an SQL query:: - POST /_opensearch/_sql + POST /_plugins/_sql { "query" : """ SELECT account_number, address, _score diff --git a/docs/user/beyond/partiql.rst b/docs/user/beyond/partiql.rst index 52eada8e508..6ad93ddeafc 100644 --- a/docs/user/beyond/partiql.rst +++ b/docs/user/beyond/partiql.rst @@ -239,7 +239,7 @@ In the following example, it finds nested document (project) with field value (n SQL query:: - POST /_opensearch/_sql + POST /_plugins/_sql { "query" : """ SELECT e.name AS employeeName, @@ -332,7 +332,7 @@ Alternatively, a nested collection can be unnested in subquery to check if it sa SQL query:: - POST /_opensearch/_sql + POST /_plugins/_sql { "query" : """ SELECT e.name AS employeeName diff --git a/docs/user/dml/delete.rst b/docs/user/dml/delete.rst index e3d19bfee18..c1689711a30 100644 --- a/docs/user/dml/delete.rst +++ b/docs/user/dml/delete.rst @@ -32,7 +32,7 @@ The ``datarows`` field in this case shows rows impacted, in other words how many SQL query:: - POST /_opensearch/_sql + POST /_plugins/_sql { "query" : """ DELETE FROM accounts diff --git a/docs/user/dql/basics.rst b/docs/user/dql/basics.rst index f3c3003dc93..d5f9d233776 100644 --- a/docs/user/dql/basics.rst +++ b/docs/user/dql/basics.rst @@ -88,7 +88,7 @@ You can use ``*`` to fetch all fields in the index which is very convenient when SQL query:: - POST /_opensearch/_sql + POST /_plugins/_sql { "query" : "SELECT * FROM accounts" } @@ -122,7 +122,7 @@ More often you would give specific field name(s) in ``SELECT`` clause to avoid l SQL query:: - POST /_opensearch/_sql + POST /_plugins/_sql { "query" : "SELECT firstname, lastname FROM accounts" } @@ -163,7 +163,7 @@ Alias is often used to make your query more readable by giving your field a shor SQL query:: - POST /_opensearch/_sql + POST /_plugins/_sql { "query" : "SELECT account_number AS num FROM accounts" } @@ -203,7 +203,7 @@ By default, ``SELECT ALL`` takes effect to return all rows. ``DISTINCT`` is usef SQL query:: - POST /_opensearch/_sql + POST /_plugins/_sql { "query" : "SELECT DISTINCT age FROM accounts" } @@ -291,7 +291,7 @@ Similarly you can give index in ``FROM`` clause an alias and use it across claus SQL query:: - POST /_opensearch/_sql + POST /_plugins/_sql { "query" : "SELECT acc.account_number FROM accounts acc" } @@ -303,7 +303,7 @@ Alternatively you can query from multiple indices of similar names by index patt SQL query:: - POST /_opensearch/_sql + POST /_plugins/_sql { "query" : "SELECT account_number FROM account*" } @@ -315,7 +315,7 @@ You can also specify type name explicitly though this has been deprecated in lat SQL query:: - POST /_opensearch/_sql + POST /_plugins/_sql { "query" : "SELECT account_number FROM accounts/account" } @@ -339,7 +339,7 @@ Basic comparison operators, such as ``=``, ``<>``, ``>``, ``>=``, ``<``, ``<=``, SQL query:: - POST /_opensearch/_sql + POST /_plugins/_sql { "query" : """ SELECT account_number @@ -403,7 +403,7 @@ Note that for now we don't differentiate missing field and field set to ``NULL`` SQL query:: - POST /_opensearch/_sql + POST /_plugins/_sql { "query" : """ SELECT account_number, employer @@ -480,7 +480,7 @@ Example 1: Grouping by Fields SQL query:: - POST /_opensearch/_sql + POST /_plugins/_sql { "query" : """ SELECT age @@ -544,7 +544,7 @@ Field alias is accessible in ``GROUP BY`` clause. SQL query:: - POST /_opensearch/_sql + POST /_plugins/_sql { "query" : """ SELECT account_number AS num @@ -608,7 +608,7 @@ Alternatively field ordinal in ``SELECT`` clause can be used too. However this i SQL query:: - POST /_opensearch/_sql + POST /_plugins/_sql { "query" : """ SELECT age @@ -672,7 +672,7 @@ Scalar function can be used in ``GROUP BY`` clause and it's required to be prese SQL query:: - POST /_opensearch/_sql + POST /_plugins/_sql { "query" : """ SELECT ABS(age) AS a @@ -754,7 +754,7 @@ Example SQL query:: - POST /_opensearch/_sql + POST /_plugins/_sql { "query" : """ SELECT age, MAX(balance) @@ -849,7 +849,7 @@ Besides regular field names, ordinal, alias or scalar function can also be used SQL query:: - POST /_opensearch/_sql + POST /_plugins/_sql { "query" : "SELECT account_number FROM accounts ORDER BY account_number DESC" } @@ -896,7 +896,7 @@ Additionally you can specify if documents with missing field be put first or las SQL query:: - POST /_opensearch/_sql + POST /_plugins/_sql { "query" : """ SELECT employer @@ -1016,7 +1016,7 @@ Given a positive number, ``LIMIT`` uses it as page size to fetch result of that SQL query:: - POST /_opensearch/_sql + POST /_plugins/_sql { "query" : """ SELECT account_number @@ -1061,7 +1061,7 @@ Offset position can be given as first argument to indicate where to start fetchi SQL query:: - POST /_opensearch/_sql + POST /_plugins/_sql { "query" : """ SELECT account_number diff --git a/docs/user/dql/complex.rst b/docs/user/dql/complex.rst index 082a5a4c941..17009d712ba 100644 --- a/docs/user/dql/complex.rst +++ b/docs/user/dql/complex.rst @@ -24,7 +24,7 @@ Example 1: Table Subquery SQL query:: - POST /_opensearch/_sql + POST /_plugins/_sql { "query" : """ SELECT a1.firstname, a1.lastname, a1.balance @@ -174,7 +174,7 @@ Example 2: Subquery in FROM Clause SQL query:: - POST /_opensearch/_sql + POST /_plugins/_sql { "query" : """ SELECT a.f, a.l, a.a @@ -301,7 +301,7 @@ Inner join is very commonly used that creates a new result set by combining colu SQL query:: - POST /_opensearch/_sql + POST /_plugins/_sql { "query" : """ SELECT @@ -399,7 +399,7 @@ Cross join or Cartesian join combines each document from the first index with ea SQL query:: - POST /_opensearch/_sql + POST /_plugins/_sql { "query" : """ SELECT @@ -448,7 +448,7 @@ Outer join is used to retain documents from one or both indices although it does SQL query:: - POST /_opensearch/_sql + POST /_plugins/_sql { "query" : """ SELECT diff --git a/docs/user/dql/metadata.rst b/docs/user/dql/metadata.rst index ee984423db4..7ffc2ffe38f 100644 --- a/docs/user/dql/metadata.rst +++ b/docs/user/dql/metadata.rst @@ -36,7 +36,7 @@ Example 1: Show All Indices Information SQL query:: - POST /_opensearch/_sql + POST /_plugins/_sql { "query" : "SHOW TABLES LIKE %" } @@ -59,7 +59,7 @@ Here is an example that searches metadata for index name prefixed by 'acc'. Besi SQL query:: - POST /_opensearch/_sql + POST /_plugins/_sql { "query" : "SHOW TABLES LIKE acc%" } @@ -80,7 +80,7 @@ Example 3: Describe Index Fields Information SQL query:: - POST /_opensearch/_sql + POST /_plugins/_sql { "query" : "DESCRIBE TABLES LIKE accounts" } diff --git a/docs/user/dql/newsql.rst b/docs/user/dql/newsql.rst index 6b1aa8296db..2a1c8f4b6ee 100644 --- a/docs/user/dql/newsql.rst +++ b/docs/user/dql/newsql.rst @@ -16,7 +16,7 @@ Introduction To use the SQL features present in documentation correctly, you need to enable our new SQL query engine by the following command:: sh$ curl -sS -H 'Content-Type: application/json' \ - ... -X PUT localhost:9200/_opensearch/_sql/settings \ + ... -X PUT localhost:9200/_plugins/_sql/settings \ ... -d '{"transient" : {"opensearch.sql.engine.new.enabled" : "true"}}' { "acknowledged": true, diff --git a/docs/user/dql/troubleshooting.rst b/docs/user/dql/troubleshooting.rst index ba10613e417..b57479c3742 100644 --- a/docs/user/dql/troubleshooting.rst +++ b/docs/user/dql/troubleshooting.rst @@ -25,7 +25,7 @@ Query: .. code-block:: JSON - POST /_opensearch/_sql + POST /_plugins/_sql { "query" : "SELECT * FROM sample:data" } @@ -51,7 +51,7 @@ You need to confirm if the syntax is not supported and disable query analysis if .. code-block:: JSON - POST /_opensearch/_sql + POST /_plugins/_sql { "query" : "SELECT * FROM `sample:data`" } @@ -74,7 +74,7 @@ Go to the step 2 if not working. }' #Verify if the query can pass the verification now - curl -H 'Content-Type: application/json' -X POST localhost:9200/_opensearch/_sql -d '{ + curl -H 'Content-Type: application/json' -X POST localhost:9200/_plugins/_sql -d '{ "query" : "SELECT * FROM ..." }' diff --git a/docs/user/interfaces/endpoint.rst b/docs/user/interfaces/endpoint.rst index e3f71c660bf..f8e2c27760d 100644 --- a/docs/user/interfaces/endpoint.rst +++ b/docs/user/interfaces/endpoint.rst @@ -29,7 +29,7 @@ Example SQL query:: - >> curl -H 'Content-Type: application/json' -X POST localhost:9200/_opensearch/_sql -d '{ + >> curl -H 'Content-Type: application/json' -X POST localhost:9200/_plugins/_sql -d '{ "query" : "SELECT * FROM accounts" }' @@ -46,7 +46,7 @@ Example Explain query:: - >> curl -H 'Content-Type: application/json' -X POST localhost:9200/_opensearch/_sql/_explain -d '{ + >> curl -H 'Content-Type: application/json' -X POST localhost:9200/_plugins/_sql/_explain -d '{ "query" : "SELECT firstname, lastname FROM accounts WHERE age > 20" }' @@ -104,7 +104,7 @@ Example SQL query:: - >> curl -H 'Content-Type: application/json' -X POST localhost:9200/_opensearch/_sql -d '{ + >> curl -H 'Content-Type: application/json' -X POST localhost:9200/_plugins/_sql -d '{ "fetch_size" : 5, "query" : "SELECT firstname, lastname FROM accounts WHERE age > 20 ORDER BY state ASC" }' diff --git a/docs/user/interfaces/protocol.rst b/docs/user/interfaces/protocol.rst index dfddb70344c..85e48118fac 100644 --- a/docs/user/interfaces/protocol.rst +++ b/docs/user/interfaces/protocol.rst @@ -32,7 +32,7 @@ Use `filter` to add more conditions to OpenSearch DSL directly. SQL query:: - >> curl -H 'Content-Type: application/json' -X POST localhost:9200/_opensearch/_sql -d '{ + >> curl -H 'Content-Type: application/json' -X POST localhost:9200/_plugins/_sql -d '{ "query" : "SELECT firstname, lastname, balance FROM accounts", "filter" : { "range" : { @@ -92,7 +92,7 @@ Use `parameters` for actual parameter value in prepared SQL query. SQL query:: - >> curl -H 'Content-Type: application/json' -X POST localhost:9200/_opensearch/_sql -d '{ + >> curl -H 'Content-Type: application/json' -X POST localhost:9200/_plugins/_sql -d '{ "query" : "SELECT * FROM accounts WHERE age = ?", "parameters" : [ { @@ -148,7 +148,7 @@ Here is an example for normal response. The `schema` includes field name and its SQL query:: - >> curl -H 'Content-Type: application/json' -X POST localhost:9200/_opensearch/_sql -d '{ + >> curl -H 'Content-Type: application/json' -X POST localhost:9200/_plugins/_sql -d '{ "query" : "SELECT firstname, lastname, age FROM accounts ORDER BY age LIMIT 2" }' @@ -193,7 +193,7 @@ If any error occurred, error message and the cause will be returned instead. SQL query:: - >> curl -H 'Content-Type: application/json' -X POST localhost:9200/_opensearch/_sql?format=jdbc -d '{ + >> curl -H 'Content-Type: application/json' -X POST localhost:9200/_plugins/_sql?format=jdbc -d '{ "query" : "SELECT unknown FROM accounts" }' @@ -221,7 +221,7 @@ Example SQL query:: - >> curl -H 'Content-Type: application/json' -X POST localhost:9200/_opensearch/_sql?format=json -d '{ + >> curl -H 'Content-Type: application/json' -X POST localhost:9200/_plugins/_sql?format=json -d '{ "query" : "SELECT firstname, lastname, age FROM accounts ORDER BY age LIMIT 2" }' @@ -288,7 +288,7 @@ Example SQL query:: - >> curl -H 'Content-Type: application/json' -X POST localhost:9200/_opensearch/_sql?format=csv -d '{ + >> curl -H 'Content-Type: application/json' -X POST localhost:9200/_plugins/_sql?format=csv -d '{ "query" : "SELECT firstname, lastname, age FROM accounts ORDER BY age" }' @@ -314,7 +314,7 @@ For example:: "=lastname": "@Bond", "address": "671 Bristol Street, Dente, TN" }' - >> curl -H 'Content-Type: application/json' -X POST localhost:9200/_opensearch/_sql?format=csv -d '{ + >> curl -H 'Content-Type: application/json' -X POST localhost:9200/_plugins/_sql?format=csv -d '{ "query" : "SELECT firstname, lastname, address FROM userdata" }' @@ -326,7 +326,7 @@ Result set:: If you prefer escaping the sanitization and keeping the original csv result, you can add a "sanitize" param and set it to false value to skip sanitizing. For example:: - >> curl -H 'Content-Type: application/json' -X POST localhost:9200/_opensearch/_sql?format=csv&sanitize=false -d '{ + >> curl -H 'Content-Type: application/json' -X POST localhost:9200/_plugins/_sql?format=csv&sanitize=false -d '{ "query" : "SELECT firstname, lastname, address FROM userdata" }' @@ -350,7 +350,7 @@ Example SQL query:: - >> curl -H 'Content-Type: application/json' -X POST localhost:9200/_opensearch/_sql?format=raw -d '{ + >> curl -H 'Content-Type: application/json' -X POST localhost:9200/_plugins/_sql?format=raw -d '{ "query" : "SELECT firstname, lastname, age FROM accounts ORDER BY age" }' @@ -374,7 +374,7 @@ For example:: "=lastname": "@Bond", "address": "671 Bristol Street|, Dente, TN" }' - >> curl -H 'Content-Type: application/json' -X POST localhost:9200/_opensearch/_sql?format=csv -d '{ + >> curl -H 'Content-Type: application/json' -X POST localhost:9200/_plugins/_sql?format=csv -d '{ "query" : "SELECT firstname, lastname, address FROM userdata" }' diff --git a/docs/user/limitations/limitations.rst b/docs/user/limitations/limitations.rst index 5ee2c72861f..c2163af23db 100644 --- a/docs/user/limitations/limitations.rst +++ b/docs/user/limitations/limitations.rst @@ -88,7 +88,7 @@ Limitations on Pagination Pagination only supports basic queries for now. The pagination query enables you to get back paginated responses. Currently, the pagination only supports basic queries. For example, the following query returns the data with cursor id:: - POST _opensearch/_sql/ + POST _plugins/_sql/ { "fetch_size" : 5, "query" : "SELECT OriginCountry, DestCountry FROM opensearch_dashboards_sample_data_flights ORDER BY OriginCountry ASC" diff --git a/docs/user/optimization/optimization.rst b/docs/user/optimization/optimization.rst index 6c84263d3a5..a66be61ee24 100644 --- a/docs/user/optimization/optimization.rst +++ b/docs/user/optimization/optimization.rst @@ -32,7 +32,7 @@ Filter Merge Rule The consecutive Filter operator will be merged as one Filter operator:: sh$ curl -sS -H 'Content-Type: application/json' \ - ... -X POST localhost:9200/_opensearch/_ppl/_explain \ + ... -X POST localhost:9200/_plugins/_ppl/_explain \ ... -d '{"query" : "source=accounts | where age > 10 | where age < 20 | fields age"}' { "root": { @@ -59,7 +59,7 @@ Filter Push Down Under Sort The Filter operator should be push down under Sort operator:: sh$ curl -sS -H 'Content-Type: application/json' \ - ... -X POST localhost:9200/_opensearch/_ppl/_explain \ + ... -X POST localhost:9200/_plugins/_ppl/_explain \ ... -d '{"query" : "source=accounts | sort age | where age < 20 | fields age"}' { "root": { @@ -90,7 +90,7 @@ Push Project Into Query DSL The Project list will push down to Query DSL to `filter the source `_:: sh$ curl -sS -H 'Content-Type: application/json' \ - ... -X POST localhost:9200/_opensearch/_sql/_explain \ + ... -X POST localhost:9200/_plugins/_sql/_explain \ ... -d '{"query" : "SELECT age FROM accounts"}' { "root": { @@ -116,7 +116,7 @@ Filter Merge Into Query DSL The Filter operator will merge into OpenSearch Query DSL:: sh$ curl -sS -H 'Content-Type: application/json' \ - ... -X POST localhost:9200/_opensearch/_sql/_explain \ + ... -X POST localhost:9200/_plugins/_sql/_explain \ ... -d '{"query" : "SELECT age FROM accounts WHERE age > 30"}' { "root": { @@ -142,7 +142,7 @@ Sort Merge Into Query DSL The Sort operator will merge into OpenSearch Query DSL:: sh$ curl -sS -H 'Content-Type: application/json' \ - ... -X POST localhost:9200/_opensearch/_sql/_explain \ + ... -X POST localhost:9200/_plugins/_sql/_explain \ ... -d '{"query" : "SELECT age FROM accounts ORDER BY age"}' { "root": { @@ -165,7 +165,7 @@ The Sort operator will merge into OpenSearch Query DSL:: Because the OpenSearch Script Based Sorting can't handle NULL/MISSING value, there is one exception is that if the sort list include expression other than field reference, it will not be merged into Query DSL:: sh$ curl -sS -H 'Content-Type: application/json' \ - ... -X POST localhost:9200/_opensearch/_sql/_explain \ + ... -X POST localhost:9200/_plugins/_sql/_explain \ ... -d '{"query" : "SELECT age FROM accounts ORDER BY abs(age)"}' { "root": { @@ -204,7 +204,7 @@ Limit Merge Into Query DSL The Limit operator will merge in OpenSearch Query DSL:: sh$ curl -sS -H 'Content-Type: application/json' \ - ... -X POST localhost:9200/_opensearch/_sql/_explain \ + ... -X POST localhost:9200/_plugins/_sql/_explain \ ... -d '{"query" : "SELECT age FROM accounts LIMIT 10 OFFSET 5"}' { "root": { @@ -227,7 +227,7 @@ The Limit operator will merge in OpenSearch Query DSL:: If sort that includes expression, which cannot be merged into query DSL, also exists in the query, the Limit operator will not be merged into query DSL as well:: sh$ curl -sS -H 'Content-Type: application/json' \ - ... -X POST localhost:9200/_opensearch/_sql/_explain \ + ... -X POST localhost:9200/_plugins/_sql/_explain \ ... -d '{"query" : "SELECT age FROM accounts ORDER BY abs(age) LIMIT 10"}' { "root": { @@ -275,7 +275,7 @@ Aggregation Merge Into OpenSearch Aggregation The Aggregation operator will merge into OpenSearch Aggregation:: sh$ curl -sS -H 'Content-Type: application/json' \ - ... -X POST localhost:9200/_opensearch/_sql/_explain \ + ... -X POST localhost:9200/_plugins/_sql/_explain \ ... -d '{"query" : "SELECT gender, avg(age) FROM accounts GROUP BY gender"}' { "root": { @@ -301,7 +301,7 @@ Sort Merge Into OpenSearch Aggregation The Sort operator will merge into OpenSearch Aggregation.:: sh$ curl -sS -H 'Content-Type: application/json' \ - ... -X POST localhost:9200/_opensearch/_sql/_explain \ + ... -X POST localhost:9200/_plugins/_sql/_explain \ ... -d '{"query" : "SELECT gender, avg(age) FROM accounts GROUP BY gender ORDER BY gender DESC NULLS LAST"}' { "root": { @@ -324,7 +324,7 @@ The Sort operator will merge into OpenSearch Aggregation.:: Because the OpenSearch Composite Aggregation order doesn't support separate NULL_FIRST/NULL_LAST option. only the default sort option (ASC NULL_FIRST/DESC NULL_LAST) will be supported for push down to OpenSearch Aggregation, otherwise it will fall back to the default memory based operator:: sh$ curl -sS -H 'Content-Type: application/json' \ - ... -X POST localhost:9200/_opensearch/_sql/_explain \ + ... -X POST localhost:9200/_plugins/_sql/_explain \ ... -d '{"query" : "SELECT gender, avg(age) FROM accounts GROUP BY gender ORDER BY gender ASC NULLS LAST"}' { "root": { @@ -360,7 +360,7 @@ Because the OpenSearch Composite Aggregation order doesn't support separate NULL Because the OpenSearch Composite Aggregation doesn't support order by metrics field, then if the sort list include fields which refer to metrics aggregation, then the sort operator can't be push down to OpenSearch Aggregation:: sh$ curl -sS -H 'Content-Type: application/json' \ - ... -X POST localhost:9200/_opensearch/_sql/_explain \ + ... -X POST localhost:9200/_plugins/_sql/_explain \ ... -d '{"query" : "SELECT gender, avg(age) FROM accounts GROUP BY gender ORDER BY avg(age)"}' { "root": { diff --git a/integ-test/src/test/java/org/opensearch/sql/doctest/core/test/DocBuilderTest.java b/integ-test/src/test/java/org/opensearch/sql/doctest/core/test/DocBuilderTest.java index a7181d40b7a..67d1feaff03 100644 --- a/integ-test/src/test/java/org/opensearch/sql/doctest/core/test/DocBuilderTest.java +++ b/integ-test/src/test/java/org/opensearch/sql/doctest/core/test/DocBuilderTest.java @@ -128,7 +128,7 @@ public void sectionShouldIncludeMultiLineSql() { paragraph("This is an example for the test"). codeBlock( "SQL query", - "POST /_opensearch/_sql\n" + + "POST /_plugins/_sql\n" + "{\n" + " \"query\" : \"\"\"\n" + "\tSELECT firstname\n" + @@ -159,7 +159,7 @@ public void sectionShouldIncludeExample() { paragraph("This is an example for the test"). codeBlock( "SQL query", - "POST /_opensearch/_sql\n" + + "POST /_plugins/_sql\n" + "{\n" + " \"query\" : \"SELECT firstname FROM accounts\"\n" + "}" diff --git a/integ-test/src/test/java/org/opensearch/sql/doctest/core/test/SqlRequestFormatTest.java b/integ-test/src/test/java/org/opensearch/sql/doctest/core/test/SqlRequestFormatTest.java index 944a2ee5b10..9c85cca251b 100644 --- a/integ-test/src/test/java/org/opensearch/sql/doctest/core/test/SqlRequestFormatTest.java +++ b/integ-test/src/test/java/org/opensearch/sql/doctest/core/test/SqlRequestFormatTest.java @@ -59,7 +59,7 @@ public void testIgnoreRequestFormat() { @Test public void testCurlFormat() { String expected = - ">> curl -H 'Content-Type: application/json' -X POST localhost:9200/_opensearch/_sql?format=jdbc -d '{\n" + + ">> curl -H 'Content-Type: application/json' -X POST localhost:9200/_plugins/_sql?format=jdbc -d '{\n" + " \"query\" : \"SELECT * FROM accounts\"\n" + "}'"; assertThat(CURL_REQUEST.format(sqlRequest), is(expected)); @@ -68,7 +68,7 @@ public void testCurlFormat() { @Test public void testOpenSearchDashboardsFormat() { String expected = - "POST /_opensearch/_sql?format=jdbc\n" + + "POST /_plugins/_sql?format=jdbc\n" + "{\n" + " \"query\" : \"SELECT * FROM accounts\"\n" + "}"; @@ -79,12 +79,12 @@ public void testOpenSearchDashboardsFormat() { public void multiLineSqlInOpenSearchDashboardRequestShouldBeWellFormatted() { SqlRequest multiLineSqlRequest = new SqlRequest( "POST", - "/_opensearch/_sql", + "/_plugins/_sql", "{\"query\":\"SELECT *\\nFROM accounts\\nWHERE age > 30\"}" ); String expected = - "POST /_opensearch/_sql\n" + + "POST /_plugins/_sql\n" + "{\n" + " \"query\" : \"\"\"\n" + "\tSELECT *\n" + diff --git a/integ-test/src/test/java/org/opensearch/sql/legacy/CsvFormatResponseIT.java b/integ-test/src/test/java/org/opensearch/sql/legacy/CsvFormatResponseIT.java index 80fb0b145ea..78bf79de34f 100644 --- a/integ-test/src/test/java/org/opensearch/sql/legacy/CsvFormatResponseIT.java +++ b/integ-test/src/test/java/org/opensearch/sql/legacy/CsvFormatResponseIT.java @@ -754,7 +754,7 @@ private CSVResult executeCsvRequest(final String query, boolean flat, boolean in final String requestBody = super.makeRequest(query); final String endpoint = String.format(Locale.ROOT, - "/_opensearch/_sql?format=csv&flat=%b&_id=%b&_score=%b&_type=%b", + "/_plugins/_sql?format=csv&flat=%b&_id=%b&_score=%b&_type=%b", flat, includeId, includeScore, includeType); final Request sqlRequest = new Request("POST", endpoint); sqlRequest.setJsonEntity(requestBody); diff --git a/integ-test/src/test/java/org/opensearch/sql/legacy/PrettyFormatterIT.java b/integ-test/src/test/java/org/opensearch/sql/legacy/PrettyFormatterIT.java index 3680b50f4a4..ee151cf34a4 100644 --- a/integ-test/src/test/java/org/opensearch/sql/legacy/PrettyFormatterIT.java +++ b/integ-test/src/test/java/org/opensearch/sql/legacy/PrettyFormatterIT.java @@ -68,7 +68,7 @@ public void assertExplainPrettyFormatted() throws IOException { } private String executeExplainRequest(String query, String explainParam) throws IOException { - String endpoint = "/_opensearch/_sql/_explain?" + explainParam; + String endpoint = "/_plugins/_sql/_explain?" + explainParam; String request = makeRequest(query); Request sqlRequest = new Request("POST", endpoint); diff --git a/integ-test/src/test/java/org/opensearch/sql/legacy/QueryAnalysisIT.java b/integ-test/src/test/java/org/opensearch/sql/legacy/QueryAnalysisIT.java index 8708ec82a1e..55095f7eadf 100644 --- a/integ-test/src/test/java/org/opensearch/sql/legacy/QueryAnalysisIT.java +++ b/integ-test/src/test/java/org/opensearch/sql/legacy/QueryAnalysisIT.java @@ -326,7 +326,7 @@ private void queryShouldThrowExceptionWithRestStatus(String query, Class } private void queryShouldPassAnalysis(String query) { - String endpoint = "/_opensearch/_sql?"; + String endpoint = "/_plugins/_sql?"; String requestBody = makeRequest(query); Request sqlRequest = new Request("POST", endpoint); sqlRequest.setJsonEntity(requestBody); diff --git a/integ-test/src/test/java/org/opensearch/sql/legacy/SQLIntegTestCase.java b/integ-test/src/test/java/org/opensearch/sql/legacy/SQLIntegTestCase.java index 36ba0fd612e..c8890f995d0 100644 --- a/integ-test/src/test/java/org/opensearch/sql/legacy/SQLIntegTestCase.java +++ b/integ-test/src/test/java/org/opensearch/sql/legacy/SQLIntegTestCase.java @@ -234,7 +234,7 @@ protected Request getSqlCursorCloseRequest(String cursorRequest) { protected String executeQuery(String query, String requestType) { try { - String endpoint = "/_opensearch/_sql?format=" + requestType; + String endpoint = "/_plugins/_sql?format=" + requestType; String requestBody = makeRequest(query); Request sqlRequest = new Request("POST", endpoint); @@ -252,7 +252,7 @@ protected String executeQuery(String query, String requestType) { protected String executeFetchQuery(String query, int fetchSize, String requestType) throws IOException { - String endpoint = "/_opensearch/_sql?format=" + requestType; + String endpoint = "/_plugins/_sql?format=" + requestType; String requestBody = makeRequest(query, fetchSize); Request sqlRequest = new Request("POST", endpoint); @@ -265,7 +265,7 @@ protected String executeFetchQuery(String query, int fetchSize, String requestTy protected String executeFetchLessQuery(String query, String requestType) throws IOException { - String endpoint = "/_opensearch/_sql?format=" + requestType; + String endpoint = "/_plugins/_sql?format=" + requestType; String requestBody = makeFetchLessRequest(query); Request sqlRequest = new Request("POST", endpoint); diff --git a/integ-test/src/test/java/org/opensearch/sql/ppl/MetricsIT.java b/integ-test/src/test/java/org/opensearch/sql/ppl/MetricsIT.java index f3b81666eea..4d3f4a411a6 100644 --- a/integ-test/src/test/java/org/opensearch/sql/ppl/MetricsIT.java +++ b/integ-test/src/test/java/org/opensearch/sql/ppl/MetricsIT.java @@ -67,7 +67,7 @@ private void multiQueries(int n) throws IOException { private Request makeStatRequest() { return new Request( - "GET", "/_opensearch/_ppl/stats" + "GET", "/_plugins/_ppl/stats" ); } diff --git a/integ-test/src/test/java/org/opensearch/sql/ppl/PPLPluginIT.java b/integ-test/src/test/java/org/opensearch/sql/ppl/PPLPluginIT.java index ff80a9573b4..07aeed18155 100644 --- a/integ-test/src/test/java/org/opensearch/sql/ppl/PPLPluginIT.java +++ b/integ-test/src/test/java/org/opensearch/sql/ppl/PPLPluginIT.java @@ -108,7 +108,7 @@ public void sqlEnableSettingsTest() throws IOException { } protected Request makePPLRequest(String query) { - Request post = new Request("POST", "/_opensearch/_ppl"); + Request post = new Request("POST", "/_plugins/_ppl"); post.setJsonEntity(String.format(Locale.ROOT, "{\n" + " \"query\": \"%s\"\n" + "}", query)); return post; } diff --git a/legacy/src/main/java/org/opensearch/sql/legacy/plugin/RestSqlAction.java b/legacy/src/main/java/org/opensearch/sql/legacy/plugin/RestSqlAction.java index 0a3cdd4c684..a4d4af18b9f 100644 --- a/legacy/src/main/java/org/opensearch/sql/legacy/plugin/RestSqlAction.java +++ b/legacy/src/main/java/org/opensearch/sql/legacy/plugin/RestSqlAction.java @@ -100,7 +100,7 @@ public class RestSqlAction extends BaseRestHandler { /** * API endpoint path */ - public static final String QUERY_API_ENDPOINT = "/_opensearch/_sql"; + public static final String QUERY_API_ENDPOINT = "/_plugins/_sql"; public static final String EXPLAIN_API_ENDPOINT = QUERY_API_ENDPOINT + "/_explain"; public static final String CURSOR_CLOSE_ENDPOINT = QUERY_API_ENDPOINT + "/close"; public static final String LEGACY_QUERY_API_ENDPOINT = "/_opendistro/_sql"; diff --git a/legacy/src/main/java/org/opensearch/sql/legacy/plugin/RestSqlSettingsAction.java b/legacy/src/main/java/org/opensearch/sql/legacy/plugin/RestSqlSettingsAction.java index e2959e6a5ac..45d2fd44512 100644 --- a/legacy/src/main/java/org/opensearch/sql/legacy/plugin/RestSqlSettingsAction.java +++ b/legacy/src/main/java/org/opensearch/sql/legacy/plugin/RestSqlSettingsAction.java @@ -70,7 +70,7 @@ public class RestSqlSettingsAction extends BaseRestHandler { /** * API endpoint path */ - public static final String SETTINGS_API_ENDPOINT = "/_opensearch/_sql/settings"; + public static final String SETTINGS_API_ENDPOINT = "/_plugins/_sql/settings"; public static final String LEGACY_SETTINGS_API_ENDPOINT = "/_opendistro/_sql/settings"; public RestSqlSettingsAction(Settings settings, RestController restController) { diff --git a/legacy/src/main/java/org/opensearch/sql/legacy/plugin/RestSqlStatsAction.java b/legacy/src/main/java/org/opensearch/sql/legacy/plugin/RestSqlStatsAction.java index d9769155d59..35c7ddddc08 100644 --- a/legacy/src/main/java/org/opensearch/sql/legacy/plugin/RestSqlStatsAction.java +++ b/legacy/src/main/java/org/opensearch/sql/legacy/plugin/RestSqlStatsAction.java @@ -56,7 +56,7 @@ public class RestSqlStatsAction extends BaseRestHandler { /** * API endpoint path */ - public static final String STATS_API_ENDPOINT = "/_opensearch/_sql/stats"; + public static final String STATS_API_ENDPOINT = "/_plugins/_sql/stats"; public static final String LEGACY_STATS_API_ENDPOINT = "/_opendistro/_sql/stats"; public RestSqlStatsAction(Settings settings, RestController restController) { diff --git a/plugin/src/main/java/org/opensearch/sql/plugin/rest/RestPPLQueryAction.java b/plugin/src/main/java/org/opensearch/sql/plugin/rest/RestPPLQueryAction.java index a08f9dfdad9..68c4550d039 100644 --- a/plugin/src/main/java/org/opensearch/sql/plugin/rest/RestPPLQueryAction.java +++ b/plugin/src/main/java/org/opensearch/sql/plugin/rest/RestPPLQueryAction.java @@ -78,8 +78,8 @@ import org.springframework.context.annotation.AnnotationConfigApplicationContext; public class RestPPLQueryAction extends BaseRestHandler { - public static final String QUERY_API_ENDPOINT = "/_opensearch/_ppl"; - public static final String EXPLAIN_API_ENDPOINT = "/_opensearch/_ppl/_explain"; + public static final String QUERY_API_ENDPOINT = "/_plugins/_ppl"; + public static final String EXPLAIN_API_ENDPOINT = "/_plugins/_ppl/_explain"; public static final String LEGACY_QUERY_API_ENDPOINT = "/_opendistro/_ppl"; public static final String LEGACY_EXPLAIN_API_ENDPOINT = "/_opendistro/_ppl/_explain"; diff --git a/plugin/src/main/java/org/opensearch/sql/plugin/rest/RestPPLStatsAction.java b/plugin/src/main/java/org/opensearch/sql/plugin/rest/RestPPLStatsAction.java index 9ca7cb76af0..50ffdc7a303 100644 --- a/plugin/src/main/java/org/opensearch/sql/plugin/rest/RestPPLStatsAction.java +++ b/plugin/src/main/java/org/opensearch/sql/plugin/rest/RestPPLStatsAction.java @@ -58,7 +58,7 @@ public class RestPPLStatsAction extends BaseRestHandler { /** * API endpoint path. */ - public static final String PPL_STATS_API_ENDPOINT = "/_opensearch/_ppl/stats"; + public static final String PPL_STATS_API_ENDPOINT = "/_plugins/_ppl/stats"; public static final String PPL_LEGACY_STATS_API_ENDPOINT = "/_opendistro/_ppl/stats"; public RestPPLStatsAction(Settings settings, RestController restController) { diff --git a/ppl/src/test/java/org/opensearch/sql/ppl/PPLServiceTest.java b/ppl/src/test/java/org/opensearch/sql/ppl/PPLServiceTest.java index 8918a044f71..9c1ef8e6961 100644 --- a/ppl/src/test/java/org/opensearch/sql/ppl/PPLServiceTest.java +++ b/ppl/src/test/java/org/opensearch/sql/ppl/PPLServiceTest.java @@ -118,7 +118,7 @@ public void testExecuteCsvFormatShouldPass() { return null; }).when(executionEngine).execute(any(), any()); - pplService.execute(new PPLQueryRequest("search source=t a=1", null, "/_opensearch/_ppl", "csv"), + pplService.execute(new PPLQueryRequest("search source=t a=1", null, "/_plugins/_ppl", "csv"), new ResponseListener() { @Override public void onResponse(QueryResponse pplQueryResponse) { diff --git a/ppl/src/test/java/org/opensearch/sql/ppl/domain/PPLQueryRequestTest.java b/ppl/src/test/java/org/opensearch/sql/ppl/domain/PPLQueryRequestTest.java index 23c676fbeda..09013d30359 100644 --- a/ppl/src/test/java/org/opensearch/sql/ppl/domain/PPLQueryRequestTest.java +++ b/ppl/src/test/java/org/opensearch/sql/ppl/domain/PPLQueryRequestTest.java @@ -48,28 +48,28 @@ public void getRequestShouldPass() { @Test public void testExplainRequest() { PPLQueryRequest request = new PPLQueryRequest( - "source=t a=1", null, "/_opensearch/_ppl/_explain"); + "source=t a=1", null, "/_plugins/_ppl/_explain"); assertTrue(request.isExplainRequest()); } @Test public void testDefaultFormat() { PPLQueryRequest request = new PPLQueryRequest( - "source=test", null, "/_opensearch/_ppl"); + "source=test", null, "/_plugins/_ppl"); assertEquals(request.format(), Format.JDBC); } @Test public void testJDBCFormat() { PPLQueryRequest request = new PPLQueryRequest( - "source=test", null, "/_opensearch/_ppl", "jdbc"); + "source=test", null, "/_plugins/_ppl", "jdbc"); assertEquals(request.format(), Format.JDBC); } @Test public void testCSVFormat() { PPLQueryRequest request = new PPLQueryRequest( - "source=test", null, "/_opensearch/_ppl", "csv"); + "source=test", null, "/_plugins/_ppl", "csv"); assertEquals(request.format(), Format.CSV); } @@ -77,7 +77,7 @@ public void testCSVFormat() { public void testUnsupportedFormat() { String format = "notsupport"; PPLQueryRequest request = new PPLQueryRequest( - "source=test", null, "/_opensearch/_ppl", format); + "source=test", null, "/_plugins/_ppl", format); exceptionRule.expect(IllegalArgumentException.class); exceptionRule.expectMessage("response in " + format + " format is not supported."); request.format(); diff --git a/sql-cli/src/opensearch_sql_cli/opensearch_connection.py b/sql-cli/src/opensearch_sql_cli/opensearch_connection.py index 24f0d9d0c35..5d23aae4581 100644 --- a/sql-cli/src/opensearch_sql_cli/opensearch_connection.py +++ b/sql-cli/src/opensearch_sql_cli/opensearch_connection.py @@ -172,14 +172,14 @@ def execute_query(self, query, output_format="jdbc", explain=False, use_console= try: if self.query_language == "sql": data = self.client.transport.perform_request( - url="/_opensearch/_sql/_explain" if explain else "/_opensearch/_sql/", + url="/_plugins/_sql/_explain" if explain else "/_plugins/_sql/", method="POST", params=None if explain else {"format": output_format}, body={"query": final_query}, ) else: data = self.client.transport.perform_request( - url="/_opensearch/_ppl/_explain" if explain else "/_opensearch/_ppl/", + url="/_plugins/_ppl/_explain" if explain else "/_plugins/_ppl/", method="POST", params=None if explain else {"format": output_format}, body={"query": final_query}, diff --git a/sql-jdbc/src/main/java/org/opensearch/jdbc/protocol/http/JsonHttpProtocol.java b/sql-jdbc/src/main/java/org/opensearch/jdbc/protocol/http/JsonHttpProtocol.java index da5fbe23f12..2dae8bc0329 100644 --- a/sql-jdbc/src/main/java/org/opensearch/jdbc/protocol/http/JsonHttpProtocol.java +++ b/sql-jdbc/src/main/java/org/opensearch/jdbc/protocol/http/JsonHttpProtocol.java @@ -49,7 +49,7 @@ public class JsonHttpProtocol implements Protocol { // the value is based on the API endpoint the sql plugin sets up, // but this could be made configurable if required - public static final String DEFAULT_SQL_CONTEXT_PATH = "/_opensearch/_sql"; + public static final String DEFAULT_SQL_CONTEXT_PATH = "/_plugins/_sql"; private static final Header acceptJson = new BasicHeader(HttpHeaders.ACCEPT, "application/json"); private static final Header contentTypeJson = new BasicHeader(HttpHeaders.CONTENT_TYPE, "application/json"); diff --git a/sql-odbc/src/odfesqlodbc/opensearch_communication.cpp b/sql-odbc/src/odfesqlodbc/opensearch_communication.cpp index cb23351e0a4..5420ce79e91 100644 --- a/sql-odbc/src/odfesqlodbc/opensearch_communication.cpp +++ b/sql-odbc/src/odfesqlodbc/opensearch_communication.cpp @@ -43,8 +43,8 @@ static const std::string ctype = "application/json"; static const std::string SQL_ENDPOINT_FORMAT_JDBC = - "/_opensearch/_sql?format=jdbc"; -static const std::string SQL_ENDPOINT_CLOSE_CURSOR = "/_opensearch/_sql/close"; + "/_plugins/_sql?format=jdbc"; +static const std::string SQL_ENDPOINT_CLOSE_CURSOR = "/_plugins/_sql/close"; static const std::string PLUGIN_ENDPOINT_FORMAT_JSON = "/_cat/plugins?format=json"; static const std::string OPENDISTRO_SQL_PLUGIN_NAME = "opensearch-sql"; diff --git a/sql/src/test/java/org/opensearch/sql/sql/SQLServiceTest.java b/sql/src/test/java/org/opensearch/sql/sql/SQLServiceTest.java index 37e56c623a2..398d111f7ee 100644 --- a/sql/src/test/java/org/opensearch/sql/sql/SQLServiceTest.java +++ b/sql/src/test/java/org/opensearch/sql/sql/SQLServiceTest.java @@ -86,7 +86,7 @@ public void canExecuteSqlQuery() { }).when(executionEngine).execute(any(), any()); sqlService.execute( - new SQLQueryRequest(new JSONObject(), "SELECT 123", "_opensearch/_sql", "jdbc"), + new SQLQueryRequest(new JSONObject(), "SELECT 123", "_plugins/_sql", "jdbc"), new ResponseListener() { @Override public void onResponse(QueryResponse response) { @@ -109,7 +109,7 @@ public void canExecuteCsvFormatRequest() { }).when(executionEngine).execute(any(), any()); sqlService.execute( - new SQLQueryRequest(new JSONObject(), "SELECT 123", "_opensearch/_sql", "csv"), + new SQLQueryRequest(new JSONObject(), "SELECT 123", "_plugins/_sql", "csv"), new ResponseListener() { @Override public void onResponse(QueryResponse response) { @@ -170,7 +170,7 @@ public void onFailure(Exception e) { @Test public void canCaptureErrorDuringExecution() { sqlService.execute( - new SQLQueryRequest(new JSONObject(), "SELECT", "_opensearch/_sql", ""), + new SQLQueryRequest(new JSONObject(), "SELECT", "_plugins/_sql", ""), new ResponseListener() { @Override public void onResponse(QueryResponse response) { diff --git a/sql/src/test/java/org/opensearch/sql/sql/domain/SQLQueryRequestTest.java b/sql/src/test/java/org/opensearch/sql/sql/domain/SQLQueryRequestTest.java index fc34333bfd0..7bbd7888600 100644 --- a/sql/src/test/java/org/opensearch/sql/sql/domain/SQLQueryRequestTest.java +++ b/sql/src/test/java/org/opensearch/sql/sql/domain/SQLQueryRequestTest.java @@ -95,7 +95,7 @@ public void shouldSupportQueryWithParametersAndZeroFetchSize() { public void shouldSupportExplain() { SQLQueryRequest explainRequest = SQLQueryRequestBuilder.request("SELECT 1") - .path("_opensearch/_sql/_explain") + .path("_plugins/_sql/_explain") .build(); assertTrue(explainRequest.isExplainRequest()); assertTrue(explainRequest.isSupported()); @@ -169,7 +169,7 @@ public void shouldSupportRawFormat() { private static class SQLQueryRequestBuilder { private String jsonContent; private String query; - private String path = "_/opendistro/_sql"; + private String path = "_plugins/_sql"; private String format; private Map params; diff --git a/workbench/server/services/utils/constants.ts b/workbench/server/services/utils/constants.ts index beae368d570..25e95754178 100644 --- a/workbench/server/services/utils/constants.ts +++ b/workbench/server/services/utils/constants.ts @@ -26,10 +26,10 @@ import { ParsedUrlQuery } from 'querystring'; -export const SQL_TRANSLATE_ROUTE = `/_opensearch/_sql/_explain`; -export const PPL_TRANSLATE_ROUTE = `/_opensearch/_ppl/_explain`; -export const SQL_QUERY_ROUTE = `/_opensearch/_sql`; -export const PPL_QUERY_ROUTE = `/_opensearch/_ppl`; +export const SQL_TRANSLATE_ROUTE = `/_plugins/_sql/_explain`; +export const PPL_TRANSLATE_ROUTE = `/_plugins/_ppl/_explain`; +export const SQL_QUERY_ROUTE = `/_plugins/_sql`; +export const PPL_QUERY_ROUTE = `/_plugins/_ppl`; export const FORMAT_CSV = `format=csv`; export const FORMAT_JSON = `format=json`; export const FORMAT_TEXT = `format=raw`;