# Is \_xpack/sql support to search from alias?

**URL:** <https://discuss.elastic.co/t/is-xpack-sql-support-to-search-from-alias/153356>\
**Category:** Elasticsearch\
**Created:** [October 22, 2018, 9:09am UTC](https://discuss.elastic.co/t/is-xpack-sql-support-to-search-from-alias/153356 "2018-10-22T09:09:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gaurav\_Patel](https://avatars.discourse-cdn.com/v4/letter/g/bc79bd/32.png) [@Gaurav\_Patel](https://discuss.elastic.co/u/Gaurav_Patel)\
**Post date:** [October 22, 2018, 9:09am UTC](https://discuss.elastic.co/t/is-xpack-sql-support-to-search-from-alias/153356/1 "2018-10-22T09:09:53Z")

</div>

Hi, In my project i am transforming user query to SQL statement for dynamic search.

As \_xpack/sql support to execute sql statement, i can directly or with minimum changes use my existing tested functionality with elastic search.

Wanted to know that is \_xpack allow to search in Alias to search from all indexes? is their any way to achieve this using \_xpack/sql?

e.g  
POST \_xpack/sql  
{  
"query": "SELECT \* FROM **[Alias Name]**"  
}

---

<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:** [October 23, 2018, 6:19am UTC](https://discuss.elastic.co/t/is-xpack-sql-support-to-search-from-alias/153356/2 "2018-10-23T06:19:31Z")

</div>

Hi @Gaurav_Patel,

Yes, this is possible. In fact, we rely on Elasticsearch's own index name resolution to perform the searches.

Please, note, that at the moment (the latest released version) if the searched indices don't have identical mappings, the query won't work. In the very near versions, **searching indices with different mappings will be possible** , thanks to [this PR](https://github.com/elastic/elasticsearch/pull/34718) pending reviews at the moment. One thing to keep in mind: this doesn't mean you could run join kind-of queries. "Different mappings" here means that the indices can have different fields, but those fields with the same name, must have the same mapping.

---

<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:** [November 20, 2018, 6:19am UTC](https://discuss.elastic.co/t/is-xpack-sql-support-to-search-from-alias/153356/3 "2018-11-20T06:19:38Z")

</div>

Closed on November 20, 2018, 6:19am UTC

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