mirror of
https://github.com/iSharkFly-Docs/opensearch-docs-cn
synced 2025-02-08 00:38:09 +00:00
* Merge pull request #1 from Yury-Fridlyand/dev-update-sql-relevance-docs Update SQL plugin relevance functions documentation. Co-authored-by: MaxKsyunz <maxk@bitquilltech.com> Signed-off-by: Yury Fridlyand <yuryf@bitquilltech.com> * Address PR feedback. Signed-off-by: Yury Fridlyand <yuryf@bitquilltech.com> * Address PR feedback by @joshuali925. Signed-off-by: Yury Fridlyand <yuryf@bitquilltech.com> * Remove PPL page from Observability Plugin. Add link to Observability page. Make some simple formatting changes Signed-off-by: Naarcha-AWS <naarcha@amazon.com> * Reword paragraph Signed-off-by: Naarcha-AWS <naarcha@amazon.com> * Adds SQL and PPL API and other SQL plugin changes Signed-off-by: Fanit Kolchina <kolchfa@amazon.com> * Formatting changes Signed-off-by: Fanit Kolchina <kolchfa@amazon.com> * Incorporates editorial comments Signed-off-by: Fanit Kolchina <kolchfa@amazon.com> Signed-off-by: Yury Fridlyand <yuryf@bitquilltech.com> Signed-off-by: Naarcha-AWS <naarcha@amazon.com> Signed-off-by: Fanit Kolchina <kolchfa@amazon.com> Co-authored-by: Yury Fridlyand <yuryf@bitquilltech.com> Co-authored-by: MaxKsyunz <maxk@bitquilltech.com> Co-authored-by: Fanit Kolchina <kolchfa@amazon.com>
2.0 KiB
2.0 KiB
layout | title | parent | grand_parent | nav_order |
---|---|---|---|---|
default | Query Workbench | SQL | SQL and PPL | 1 |
Query Workbench
Use the Query Workbench to easily run on-demand SQL queries, translate SQL into its REST equivalent, and view and save results as text, JSON, JDBC, or CSV.
Quick start
To get started with SQL Workbench, choose Dev Tools in OpenSearch Dashboards and use the bulk
operation to index some sample data:
PUT accounts/_bulk?refresh
{"index":{"_id":"1"}}
{"account_number":1,"balance":39225,"firstname":"Amber","lastname":"Duke","age":32,"gender":"M","address":"880 Holmes Lane","employer":"Pyrami","email":"amberduke@pyrami.com","city":"Brogan","state":"IL"}
{"index":{"_id":"6"}}
{"account_number":6,"balance":5686,"firstname":"Hattie","lastname":"Bond","age":36,"gender":"M","address":"671 Bristol Street","employer":"Netagy","email":"hattiebond@netagy.com","city":"Dante","state":"TN"}
{"index":{"_id":"13"}}
{"account_number":13,"balance":32838,"firstname":"Nanette","lastname":"Bates","age":28,"gender":"F","address":"789 Madison Street","employer":"Quility","email":"nanettebates@quility.com","city":"Nogal","state":"VA"}
{"index":{"_id":"18"}}
{"account_number":18,"balance":4180,"firstname":"Dale","lastname":"Adams","age":33,"gender":"M","address":"467 Hutchinson Court","email":"daleadams@boink.com","city":"Orick","state":"MD"}
Then return to SQL Workbench.
List indices
To list all your indices:
SHOW TABLES LIKE %
TABLE_NAME |
---|
accounts |
Read data
After you index a document, retrieve it using the following SQL expression:
SELECT *
FROM accounts
WHERE _id = 1
account_number | firstname | gender | city | balance | employer | state | address | lastname | age | |
---|---|---|---|---|---|---|---|---|---|---|
1 | Amber | M | Brogan | 39225 | Pyrami | IL | amberduke@pyrami.com | 880 Holmes Lane | Duke | 32 |
Delete data
To delete a document from an index, use the DELETE
clause:
DELETE
FROM accounts
WHERE _id = 0
deleted_rows |
---|
1 |