# Search data last occurrence

**URL:** https://discuss.elastic.co/t/search-data-last-occurrence/128128
**Category:** Elasticsearch
**Tags:** rally
**Created:** [April 16, 2018, 8:24am UTC](https://discuss.elastic.co/t/search-data-last-occurrence/128128 "2018-04-16T08:24:52Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![niraj\_pandey](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/niraj_pandey/32/44034_2.png) [@niraj\_pandey](https://discuss.elastic.co/u/niraj_pandey)
#### Post date: [April 16, 2018, 8:24am UTC](https://discuss.elastic.co/t/search-data-last-occurrence/128128/1 "2018-04-16T08:24:53Z")

</div>

Hi,

I have a data on multiple indexes and want to search it's last occurrence. Could you please help me on this.

Here is the scenario:  
I have following indexes:

acct-2018-03-01 , acct-2018-03-02 , acct-2018-03-03 .... acct-2018-03-25 , acct-2018-03-26 ... acct-2018-04-16

I want to search the last occurrence of jobid (value 12345) from the above indexes.

Suppose It's available on indexes acct-2018-03-01,acct-2018-03-03,acct-2018-03-25.  
Now I want to print the data only from it's last occurrence (from index acct-2018-03-25).  
I am using index as a "acct-\*".

---

<div class="post-metadata">

### Author: ![niraj\_pandey](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/niraj_pandey/32/44034_2.png) [@niraj\_pandey](https://discuss.elastic.co/u/niraj_pandey)
#### Post date: [April 16, 2018, 9:49am UTC](https://discuss.elastic.co/t/search-data-last-occurrence/128128/2 "2018-04-16T09:49:32Z")

</div>

I can use "sort": [{"@timestamp": {"order": "asc"}}] and size =1 but in that case it would return only single entry from latest index and I want all entries from the latest index.

---

<div class="post-metadata">

### Author: ![dliappis](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dliappis/32/56174_2.png) [@dliappis](https://discuss.elastic.co/u/dliappis)
#### Post date: [April 16, 2018, 9:51am UTC](https://discuss.elastic.co/t/search-data-last-occurrence/128128/3 "2018-04-16T09:51:37Z")

</div>

Hey @niraj_pandey,

It appears that this question is not related to [Rally](https://esrally.readthedocs.io/en/stable/), the benchmarking tool for Elasticsearch, but rather a more general question about searching in Elasticsearch.

If, indeed, your question is not Rally specific, do you mind closing this topic, to help us keep the topics in this category focused on Rally, and open a new one under the [Elasticsearch category](https://discuss.elastic.co/c/elasticsearch) instead?

Thank you,  
Dimitris

---

<div class="post-metadata">

### Author: ![niraj\_pandey](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/niraj_pandey/32/44034_2.png) [@niraj\_pandey](https://discuss.elastic.co/u/niraj_pandey)
#### Post date: [April 17, 2018, 10:12am UTC](https://discuss.elastic.co/t/search-data-last-occurrence/128128/4 "2018-04-17T10:12:34Z")

</div>

Please close this.

Thanks

---

<div class="post-metadata">

### Author: ![dliappis](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dliappis/32/56174_2.png) [@dliappis](https://discuss.elastic.co/u/dliappis)
#### Post date: [April 17, 2018, 11:21am UTC](https://discuss.elastic.co/t/search-data-last-occurrence/128128/5 "2018-04-17T11:21:00Z")

</div>


