# Terms query without sort

**URL:** <https://discuss.elastic.co/t/terms-query-without-sort/285126>\
**Category:** Elasticsearch\
**Created:** [September 25, 2021, 7:06am UTC](https://discuss.elastic.co/t/terms-query-without-sort/285126 "2021-09-25T07:06:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sathiez](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sathiez/32/89875_2.png) [@sathiez](https://discuss.elastic.co/u/sathiez)\
**Post date:** [September 25, 2021, 7:06am UTC](https://discuss.elastic.co/t/terms-query-without-sort/285126/1 "2021-09-25T07:06:02Z")

</div>

My document:

```auto
{
	"_index": "comb_index",
	"_type": "_doc",
	"_id": "i_ZFO3sB_48g2JrGjt9P",
	"_version": 2,
	"_seq_no": 5057859,
	"_primary_term": 1,
	"found": true,
	"_source": {
		"row": "54,9658",
		"value": 1481985587
	}
}
{
	"_index": "comb_index",
	"_type": "_doc",
	"_id": "jfZFO3sB_48g2JrGjt9P",
	"_version": 2,
	"_seq_no": 5057861,
	"_primary_term": 1,
	"found": true,
	"_source": {
		"row": "4,110178",
		"value": 1482000996
	}
}

```

I am using terms query as shown below:

```auto
value = [1481985587,1482000996,1482070894]
body = {"from": 0, "size": 100,"query": {"bool": {"must" : [{ "terms": { "value": value }}]}}}

```

how to get output in same order as value? I don't want to do any sorting, how can I achieve it in Elasticsearch?

---

<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:** [September 25, 2021, 7:54am UTC](https://discuss.elastic.co/t/terms-query-without-sort/285126/2 "2021-09-25T07:54:52Z")

</div>

You can not, so need to apply sorting.

---

<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 23, 2021, 7:54am UTC](https://discuss.elastic.co/t/terms-query-without-sort/285126/3 "2021-10-23T07:54:58Z")

</div>

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