# Filtering and ordering

**URL:** <https://discuss.elastic.co/t/filtering-and-ordering/282015>\
**Category:** Elasticsearch\
**Created:** [August 19, 2021, 11:37am UTC](https://discuss.elastic.co/t/filtering-and-ordering/282015 "2021-08-19T11:37:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sriram8894](https://avatars.discourse-cdn.com/v4/letter/s/bbe5ce/32.png) [@Sriram8894](https://discuss.elastic.co/u/Sriram8894)\
**Post date:** [August 19, 2021, 11:37am UTC](https://discuss.elastic.co/t/filtering-and-ordering/282015/1 "2021-08-19T11:37:26Z")

</div>

I would like to know the reason for below case

Case 1 : Consider, I have applied a filter on documents and the order of documents in response is 1,2,3,4.  
Case 2: I have updated a field in the document 2, then If I execute the same filter on documents the order is being changed from 1,2,3,4 to 2,1,3,4.

if there is no query relevancy and we only apply a filter then Is this expected behaviour ? if yes, then in which order Elasticsearch will return the documents

Can you clarify this case please

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [August 19, 2021, 12:46pm UTC](https://discuss.elastic.co/t/filtering-and-ordering/282015/2 "2021-08-19T12:46:46Z")

</div>

If you only use filter, resulting in the same score for all matches, and do not specify a sorting that separates the matches ordering is not guaranteed and may appear random.

---

<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:** [August 19, 2021, 10:03pm UTC](https://discuss.elastic.co/t/filtering-and-ordering/282015/3 "2021-08-19T22:03:49Z")

</div>

Welcome to our community! 😃

FYI I have moved this to it's own topic.

---

<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:** [September 16, 2021, 10:03pm UTC](https://discuss.elastic.co/t/filtering-and-ordering/282015/4 "2021-09-16T22:03:56Z")

</div>

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