# Elasticsearch-Querty and Fetch phase

**URL:** <https://discuss.elastic.co/t/elasticsearch-querty-and-fetch-phase/265270>\
**Category:** Elasticsearch\
**Created:** [February 24, 2021, 2:59am UTC](https://discuss.elastic.co/t/elasticsearch-querty-and-fetch-phase/265270 "2021-02-24T02:59:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![leemase004](https://avatars.discourse-cdn.com/v4/letter/l/fbc32d/32.png) [@leemase004](https://discuss.elastic.co/u/leemase004)\
**Post date:** [February 24, 2021, 2:59am UTC](https://discuss.elastic.co/t/elasticsearch-querty-and-fetch-phase/265270/1 "2021-02-24T02:59:08Z")

</div>

I am wondering if I can get a little clarification. When a query is run:

"The coordinating node identifies which documents need to be fetched and issues a multi `GET` request to the relevant shards."

I am wondering what determines "relevant shards."  
For example our index pattern for a search is "search-ids" and is mapped to "ids-alerts-\*"

If our users attempt to run a query that is only one day old, will Elasticsearch automatically attempt to query every single index (because ids-alerts-\* was selected) or will it recognize that it only needs to view the most recent index to retrieve the relevant data.

---

<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:** [February 25, 2021, 3:00am UTC](https://discuss.elastic.co/t/elasticsearch-querty-and-fetch-phase/265270/2 "2021-02-25T03:00:15Z")

</div>

> [@leemase004](#):
>
> will it recognize that it only needs to view the most recent index to retrieve the relevant data.

The most recent, or the ones that contain the data with matching timestamps, yes 🙂

---

<div class="post-metadata">

**Author:** ![leemase004](https://avatars.discourse-cdn.com/v4/letter/l/fbc32d/32.png) [@leemase004](https://discuss.elastic.co/u/leemase004)\
**Post date:** [February 25, 2021, 3:24am UTC](https://discuss.elastic.co/t/elasticsearch-querty-and-fetch-phase/265270/3 "2021-02-25T03:24:38Z")

</div>

Thanks for the response. This is what leaves me a little confused. We recently closed and/or froze some very old indices (over 6 months old).

Our users then began receiving shard errors on their visualizations. These visualizations were only querying data from this week alone. The shard errors would show that they the visualization was trying to access index-xxxxx which we could see was one of the old indices that we had closed.

We werent sure why Elastic kept trying to look at month old indices when the time frame for the query should only look at the most recent index.

---

<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 25, 2021, 3:25am UTC](https://discuss.elastic.co/t/elasticsearch-querty-and-fetch-phase/265270/4 "2021-03-25T03:25:37Z")

</div>

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