# Multiple indices sql query

**URL:** <https://discuss.elastic.co/t/multiple-indices-sql-query/150824>\
**Category:** Elasticsearch\
**Created:** [October 3, 2018, 6:18am UTC](https://discuss.elastic.co/t/multiple-indices-sql-query/150824 "2018-10-03T06:18:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![varunarathinam](https://avatars.discourse-cdn.com/v4/letter/v/d07c76/32.png) [@varunarathinam](https://discuss.elastic.co/u/varunarathinam)\
**Post date:** [October 3, 2018, 6:18am UTC](https://discuss.elastic.co/t/multiple-indices-sql-query/150824/1 "2018-10-03T06:18:55Z")

</div>

Hi,  
Im trying to sql query from kibana side post method using. My index name like  
"sample\_index-\*" i want query in that index.

when i try to sql query i got error like;

post \_xpack/sql/translate  
{  
"query": "select age from "sample\_index-\*""  
}

But i got error like;  
which have different mappings. when using multiple indices the mappping must be identical. Please help me!!!

---

<div class="post-metadata">

**Author:** ![LGans316](https://avatars.discourse-cdn.com/v4/letter/l/cab0a1/32.png) [@LGans316](https://discuss.elastic.co/u/LGans316)\
**Post date:** [October 3, 2018, 8:05am UTC](https://discuss.elastic.co/t/multiple-indices-sql-query/150824/2 "2018-10-03T08:05:34Z")

</div>

Sadly this is how it works. Joining across multiple indices is possible only when their mappings are identical.

> **[An Introduction to Elasticsearch SQL with Practical Examples - Part 2
	  	 |...](https://www.elastic.co/blog/an-introduction-to-elasticsearch-sql-with-practical-examples-part-2)**
>
> In Part 1 of this Introduction to Elasticsearch SQL series, we provided a gentle introduction to the new Elasticsearch SQL feature as well as the \_translate API. This specific post continues the ...

If this limitation is lifted then it could potentially sway these Big Data users who work on Hive and Impala to consider Elasticsearch. 🙂

---

<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 8, 2018, 1:17pm UTC](https://discuss.elastic.co/t/multiple-indices-sql-query/150824/3 "2018-10-08T13:17:56Z")

</div>

@varunarathinam @LGans316 at the moment, indeed, the restriction exists for identical mappings. But we are working on easing this limitation.

Please, note though that there is a slight difference here between two likely scenarions:

- multiple indices where you are using the fields from both with NO relationship between them (aka `JOIN`s)
- using relationships

[We are working on the first item](https://github.com/elastic/elasticsearch/issues/31837). The second one is, at the moment, not on our list. Relationships in Elasticsearch are not so straight forward (like in a relational database), thus the difficulty that comes with this feature.

---

<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 5, 2018, 1:18pm UTC](https://discuss.elastic.co/t/multiple-indices-sql-query/150824/4 "2018-11-05T13:18:29Z")

</div>

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