# Elasticsearch sql query object in array Elasticsearch 6.3.0

**URL:** <https://discuss.elastic.co/t/elasticsearch-sql-query-object-in-array-elasticsearch-6-3-0/136631>\
**Category:** Elasticsearch\
**Created:** [June 20, 2018, 8:04am UTC](https://discuss.elastic.co/t/elasticsearch-sql-query-object-in-array-elasticsearch-6-3-0/136631 "2018-06-20T08:04:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![yuhao\_zhang](https://avatars.discourse-cdn.com/v4/letter/y/fbc32d/32.png) [@yuhao\_zhang](https://discuss.elastic.co/u/yuhao_zhang)\
**Post date:** [June 20, 2018, 8:04am UTC](https://discuss.elastic.co/t/elasticsearch-sql-query-object-in-array-elasticsearch-6-3-0/136631/1 "2018-06-20T08:04:22Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 18, 2018, 8:04am UTC](https://discuss.elastic.co/t/elasticsearch-sql-query-object-in-array-elasticsearch-6-3-0/136631/2 "2018-07-18T08:04:31Z")

</div>

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