# Elasticsearch sql is not working for some index

**URL:** <https://discuss.elastic.co/t/elasticsearch-sql-is-not-working-for-some-index/226223>\
**Category:** Elasticsearch\
**Created:** [April 2, 2020, 2:00pm UTC](https://discuss.elastic.co/t/elasticsearch-sql-is-not-working-for-some-index/226223 "2020-04-02T14:00:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sunitha.eswaraiah](https://avatars.discourse-cdn.com/v4/letter/s/bbce88/32.png) [@sunitha.eswaraiah](https://discuss.elastic.co/u/sunitha.eswaraiah)\
**Post date:** [April 2, 2020, 2:00pm UTC](https://discuss.elastic.co/t/elasticsearch-sql-is-not-working-for-some-index/226223/1 "2020-04-02T14:00:00Z")

</div>

Hi,

I'm unable to apply sql query on one index and i get this error,

```auto
{
  "error": {
    "root_cause": [
      {
        "type": "unsupported_operation_exception",
        "reason": null
      }
    ],
    "type": "unsupported_operation_exception",
    "reason": null
  },
  "status": 500
}

```

However, i can run sql queries on other indexes i have and it works perfectly fine. I'm not sure why one specific index is not working.

Any advice please?

Thanks,  
Sunitha

---

<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:** [April 3, 2020, 5:52am UTC](https://discuss.elastic.co/t/elasticsearch-sql-is-not-working-for-some-index/226223/2 "2020-04-03T05:52:34Z")

</div>

@sunitha.eswaraiah are there any `flattened` field types in that index?  
Would be useful to know the query that fails and, also, the full stack trace from logs.

A wild guess that it's about this PR: [https://github.com/elastic/elasticsearch/pull/50823](https://github.com/elastic/elasticsearch/pull/50823) but before knowing for sure, I need answers to above questions. Thanks.

---

<div class="post-metadata">

**Author:** ![sunitha.eswaraiah](https://avatars.discourse-cdn.com/v4/letter/s/bbce88/32.png) [@sunitha.eswaraiah](https://discuss.elastic.co/u/sunitha.eswaraiah)\
**Post date:** [April 4, 2020, 11:25am UTC](https://discuss.elastic.co/t/elasticsearch-sql-is-not-working-for-some-index/226223/3 "2020-04-04T11:25:02Z")

</div>

Hi @Andrei_Stefan

Thanks for the solution. I had `search_as_you_type` datatype in the mapping.  
I reindexed removing the `search_as_you_type` and i'm able to apply SQL on the index.

Thanks you 🙂 👍

---

<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:** [May 2, 2020, 11:25am UTC](https://discuss.elastic.co/t/elasticsearch-sql-is-not-working-for-some-index/226223/4 "2020-05-02T11:25:05Z")

</div>

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