# Elastic Search SQL JDBC driver maps each index to a table

**URL:** <https://discuss.elastic.co/t/elastic-search-sql-jdbc-driver-maps-each-index-to-a-table/284334>\
**Category:** Elasticsearch\
**Tags:** jdbc\
**Created:** [September 15, 2021, 9:19pm UTC](https://discuss.elastic.co/t/elastic-search-sql-jdbc-driver-maps-each-index-to-a-table/284334 "2021-09-15T21:19:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![saiyamlui](https://avatars.discourse-cdn.com/v4/letter/s/f07891/32.png) [@saiyamlui](https://discuss.elastic.co/u/saiyamlui)\
**Post date:** [September 15, 2021, 9:19pm UTC](https://discuss.elastic.co/t/elastic-search-sql-jdbc-driver-maps-each-index-to-a-table/284334/1 "2021-09-15T21:19:24Z")

</div>

I am trying to use Elastic Search SQL JDBC driver to connect to ES cluster. Our indices are partition by date dynamically, for example, we have testdata\_2021-0914, testdata\_2021-0915, etc. It appears each of these index is mapped as an individual database table.

It's quite common to partition ES index by date for scalability reason and ease of purging old data. My question is how can I query across all the indices? Thanks.

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [September 15, 2021, 9:34pm UTC](https://discuss.elastic.co/t/elastic-search-sql-jdbc-driver-maps-each-index-to-a-table/284334/2 "2021-09-15T21:34:10Z")

</div>

From [SELECT | Elasticsearch Guide [8.11] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/sql-syntax-select.html#sql-syntax-from);

> The name can be a [pattern](https://www.elastic.co/guide/en/elasticsearch/reference/current/multi-index.html) pointing to multiple indices (likely requiring quoting as mentioned above) with the restriction that **all** resolved concrete tables have **exact mapping**.

So check out that link to `pattern` 🙂

---

<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:** [October 13, 2021, 9:34pm UTC](https://discuss.elastic.co/t/elastic-search-sql-jdbc-driver-maps-each-index-to-a-table/284334/3 "2021-10-13T21:34:35Z")

</div>

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