Turing SQL uses two clauses to construct queries: query for the SQL statement and kvpair for parameters. Send queries to the /sql path as HTTP requests, which you can build manually or run with curl.
Prerequisites
Before you begin, ensure that you have:
The service IP address and port of the OpenSearch Retrieval Engine Edition V3.0 QRS
Run a query
Send a query to the /sql endpoint using curl:
curl "ip:port/sql?query=SELECT brand, COUNT(*) FROM phone GROUP BY (brand)&&kvpair=trace:INFO;formatType:json"The request combines two clauses:
query: the SQL statement to executekvpair: a semicolon-separated list of parameters
kvpair syntax
Separate multiple kvpair parameters with semicolons (;). The example above passes two parameters:
| Parameter | Value |
|---|---|
trace | INFO |
formatType | json |
Important
Do not include spaces between kvpair and &&, or between kvpair parameters. Spaces cause the query to fail at parse time.
Query paths
| Path | Description |
|---|---|
/sql | SQL query path for Turing SQL |
/ | OpenSearch Retrieval Engine Edition V3.0 query path |
该文章对您有帮助吗?