# What does one index work and other index throw an error using sql queries

**URL:** <https://discuss.elastic.co/t/what-does-one-index-work-and-other-index-throw-an-error-using-sql-queries/168897>\
**Category:** Elasticsearch\
**Created:** [February 18, 2019, 8:29pm UTC](https://discuss.elastic.co/t/what-does-one-index-work-and-other-index-throw-an-error-using-sql-queries/168897 "2019-02-18T20:29:32Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![zozo6015](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zozo6015/32/12117_2.png) [@zozo6015](https://discuss.elastic.co/u/zozo6015)\
**Post date:** [February 18, 2019, 8:29pm UTC](https://discuss.elastic.co/t/what-does-one-index-work-and-other-index-throw-an-error-using-sql-queries/168897/1 "2019-02-18T20:29:32Z")

</div>

Hello,

I am trying to use sql query on some of the beats indexes and I have observed that some indices are showing up the queries propertly while others are throwing an error:

For example:

```
curl -XPOST "http://localhost:9200/_xpack/sql?format=txt" -H 'Content-Type: application/json' -d'
{
  "query" : " DESCRIBE \"metricbeat-6.5.1-*\" "
}'

                                column | type | mapping    
----------------------------------------------------------------------+---------------+---------------
@timestamp |TIMESTAMP |DATE           
aerospike |STRUCT |OBJECT         
aerospike.namespace |STRUCT |OBJECT         
aerospike.namespace.client |STRUCT |OBJECT         
aerospike.namespace.client.delete |STRUCT |OBJECT         
aerospike.namespace.client.delete.error |BIGINT |LONG     

```

while:

```
curl -XPOST "http://localhost:9200/_xpack/sql?format=txt" -H 'Content-Type: application/json' -d'
{
  "query" : " DESCRIBE \"metricbeat-6.6.0-*\" "
}'

```

is just giving this error:

```
{
  "error": {
    "root_cause": [
      {
        "type": "sql_illegal_argument_exception",
        "reason": "Cannot find field container; this is likely a bug"
      }
    ],
    "type": "sql_illegal_argument_exception",
    "reason": "Cannot find field container; this is likely a bug"
  },
  "status": 500
}
```

---

<div class="post-metadata">

**Author:** ![Andrei\_Stefan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrei_stefan/32/47533_2.png) [@Andrei\_Stefan](https://discuss.elastic.co/u/Andrei_Stefan)\
**Post date:** [February 18, 2019, 9:16pm UTC](https://discuss.elastic.co/t/what-does-one-index-work-and-other-index-throw-an-error-using-sql-queries/168897/2 "2019-02-18T21:16:11Z")

</div>

Hey there.  
We had a somewhat related bug (that issue is [here](https://github.com/elastic/elasticsearch/issues/37224)), but I am not sure if it's the same one.  
You can check the mappings of your `metricbeat-6.6.0-*` indices and see if there are any [alias type](https://www.elastic.co/guide/en/elasticsearch/reference/6.6/alias.html) of fields in them. If there are, then there are high chances the issue is the same.

---

<div class="post-metadata">

**Author:** ![zozo6015](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zozo6015/32/12117_2.png) [@zozo6015](https://discuss.elastic.co/u/zozo6015)\
**Post date:** [February 18, 2019, 9:23pm UTC](https://discuss.elastic.co/t/what-does-one-index-work-and-other-index-throw-an-error-using-sql-queries/168897/3 "2019-02-18T21:23:32Z")

</div>

Yeah, there are few alias type of fields in the mapping of that index while the working indices has no alias.

---

<div class="post-metadata">

**Author:** ![Andrei\_Stefan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrei_stefan/32/47533_2.png) [@Andrei\_Stefan](https://discuss.elastic.co/u/Andrei_Stefan)\
**Post date:** [February 20, 2019, 9:08am UTC](https://discuss.elastic.co/t/what-does-one-index-work-and-other-index-throw-an-error-using-sql-queries/168897/4 "2019-02-20T09:08:35Z")

</div>

Ok, then yes, very likely this is the issue you are encountering: [https://github.com/elastic/elasticsearch/issues/37224](https://github.com/elastic/elasticsearch/issues/37224). In the issue you can find labels with versions where the issue is fixed.

---

<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:** [March 20, 2019, 9:08am UTC](https://discuss.elastic.co/t/what-does-one-index-work-and-other-index-throw-an-error-using-sql-queries/168897/5 "2019-03-20T09:08:43Z")

</div>

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