【问题标题】:How to query AWS ElasticSearch with SQL如何使用 SQL 查询 AWS ElasticSearch
【发布时间】:2019-11-17 12:44:33
【问题描述】:

此处的 AWS 文档表明支持 SQL 查询:https://aws.amazon.com/about-aws/whats-new/2019/05/amazon-elasticsearch-service-sql-support/

此页面显示语法: https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/sql-support.html

POST elasticsearch_domain/_opendistro/_sql
{
  "query": "SELECT * FROM my-index LIMIT 50"
}

在 Kibana 开发工具中运行以下命令

POST my_domain/_opendistro/_sql
{
  "query": "SELECT * FROM my-index LIMIT 50"
}

给出错误

{
  "error": {
    "root_cause": [
      {
        "type": "invalid_type_name_exception",
        "reason": "Document mapping type name can't start with '_', found: [_opendistro]"
      }
    ],
    "type": "invalid_type_name_exception",
    "reason": "Document mapping type name can't start with '_', found: [_opendistro]"
  },
  "status": 400
}

我的 ElasticSearch 版本是 6.7。

【问题讨论】:

    标签: sql amazon-web-services elasticsearch kibana


    【解决方案1】:

    由于您的 elasticsearch 由 AWS 驱动,并且您使用的是 Kibana 开发工具,因此您可以通过以下方式获取查询结果

    POST _opendistro/_sql
    {
      "query": "SELECT * FROM your_index "
    }
    

    您不需要输入域名。它对我有用。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-10-26
      • 1970-01-01
      • 2018-12-16
      • 1970-01-01
      • 2015-01-13
      • 2019-12-11
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多