功能概述

本小节主要介绍如何使用 OpenSearch 进行索引管理和数据查询。

操作步骤

快速管理索引

  • 创建索引

    curl -XPUT --insecure -u 'admin:Change1Pwd' 'https://<os_hot_node_ip>:9200/my-first-index'
  • 添加数据并验证,以及删除数据

    curl -XPUT --insecure -u 'admin:Change1Pwd' 'https://<os_hot_node_ip>:9200/my-first-index/_doc/1' -H 'Content-Type: application/json' -d '{"Description": "To be or not to be, that is the question."}'
    curl -XGET --insecure -u 'admin:Change1Pwd' 'https://<os_hot_node_ip>:9200/my-first-index/_doc/1'
    curl -XDELETE --insecure -u 'admin:Change1Pwd' 'https://<os_hot_node_ip>:9200/my-first-index/_doc/1'
  • 删除索引

    curl -XDELETE --insecure -u 'admin:Change1Pwd' 'https://<os_hot_node_ip>:9200/my-first-index/'

通过 Dashboard 管理

Dashboard 语法(DQL)类似于 Query DSL 允许使用 HTTP 请求主体搜索数据,您可以使用 DQL 进行可视化数据搜索。

更多 Dashboard 使用和功能介绍,请参见 OpenSearch Dashboards