数组中的Elasticsearch SQL查询对象

时间:2018-06-20 08:07:34

标签: elasticsearch

我正在尝试使用Elasticsearch 6.3.0的新的Elasticsearch功能elasticsearch sql 我有一个问题,似乎无法使用此sql功能查询数组中的对象。

例如,我已为文档编制了如下索引:

PUT /test/_doc/1
{
  "orderId": "123456",
  "items": [
    {
      "itemId": "1234",
      "name": "ipad"
    }
  ]
}

然后我尝试查询:

POST /_xpack/sql?format=txt
{
    "query": "select items.itemId from test"
}

它给我以下错误:

{
    "error": {
        "root_cause": [
            {
                "type": "sql_illegal_argument_exception",
                "reason": "Cannot extract value [items.itemId] from source"
            }
        ],
        "type": "sql_illegal_argument_exception",
        "reason": "Cannot extract value [items.itemId] from source"
    },
    "status": 500
}

我可以知道有没有一种方法可以查询数组对象中的数据?

0 个答案:

没有答案