Using OpenSearch SQL with Amazon OpenSearch Serverless
You can now use OpenSearch SQL plugin as an alternative way to query in Amazon OpenSearch Serverless. OpenSearch SQL plugin provides SQL query and Piped Processing Language (PPL) capabilites that enable you to execute read-only SQL and PPL queries as well as execute SQL joins and subqueries.
Additionally, you can perform deep pagination using sql and ppl queries, for more
information on this, see Paginating results
The following features are supported for OpenSearch SQL plugin:
-
SQL pagination
-
SQL join queries
-
WHERE
Clause/Filtering -
SQL queries
The following features are not supported for OpenSearch SQL plugin:
-
Delete queries
-
SQL stats API
You do not need to install anything to enable use of OpenSearch SQL plugin. For more
information on use of the plugin, see Introduction to OpenSearch
Plugins
Amazon OpenSearch Serverless support use of the following sql and ppl APIs:
-
POST /_plugins/_sql
-
POST /_plugins/_ppl
-
POST /_plugins/_sql/_explain
-
POST /_plugins/_ppl/_explain
-
POST /_plugins/_sql/close
All APIs are managed via aoss:ReadDocument
data access control. For more
information on supported APIs, see Supported operations in plugins in Amazon OpenSearch Serverless.
Querying using SQL plugin
OpenSearch SQL plugin converts a query string via SQL query engine and converts it to
OpenSearch Service DSL to make a SearchRequest
The following is an example of a SQL
query. Here is an example query:
POST _plugins/_sql { "query": "SELECT * FROM my-index LIMIT 50" }
Querying using PPL plugin
OpenSearch SQL plugin converts a query string via SQL query engine and converts it to
OpenSearch Service DSL to make a SearchRequest
The following is an example of a SQL
query. Here is an example query:
POST _plugins/_ppl { "query": "source=my-index | fields firstname, age | head 50" }
Pagination using OpenSearch SQL plugin
OpenSearch SQL plugin converts a query string via SQL query engine and converts it to
OpenSearch Service DSL to make a SearchRequest
The following is an example of a SQL
query. Here is an example query:
POST _plugins/_sql { "query": "SELECT * FROM my-index LIMIT 50" }