# Reading from specific index under alias

**URL:** https://discuss.elastic.co/t/reading-from-specific-index-under-alias/265079
**Category:** Elasticsearch
**Tags:** es-hadoop
**Created:** [February 22, 2021, 2:35pm UTC](https://discuss.elastic.co/t/reading-from-specific-index-under-alias/265079 "2021-02-22T14:35:16Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![b\_bal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/b_bal/32/77563_2.png) [@b\_bal](https://discuss.elastic.co/u/b_bal)
#### Post date: [February 22, 2021, 2:35pm UTC](https://discuss.elastic.co/t/reading-from-specific-index-under-alias/265079/1 "2021-02-22T14:35:17Z")

</div>

Hello!  
I have different indices named _myindex-_. Every night a new index is created(with a different number), so we use an alias(_myalias_) to keep track of the index that contains the most recent documents. Under that alias there are also other indices with different structure, so I need just _myindex-_.  
I use es-hadoop to query and right now my code looks like this:

```auto

spark.read.format("org.elasticsearch.spark.sql")
    .option(...).load(myalias?q=_index:myindex-*)

```

I think there should be a way to ready directly from that index(under the alias), without filtering. Do you have any idea? Thank 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: [March 22, 2021, 2:35pm UTC](https://discuss.elastic.co/t/reading-from-specific-index-under-alias/265079/2 "2021-03-22T14:35:47Z")

</div>

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