Elasticsearch sql query object in array Elasticsearch 6.3.0


(Yuhao Zhang) #1

Hi, I am trying out the new elasticsearch feature elasticsearch sql with elasticsearch 6.3.0
I have a question that it seems not able to query an object in an array with this sql feature.

for example I have indexed a doc as below:

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

and I try an query:

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

it gives me error as below:

{
    "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
}

may I know is there a way to query the data in objects of an array?


(system) #2

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.