# Terms query not working as expected

**URL:** <https://discuss.elastic.co/t/terms-query-not-working-as-expected/237357>\
**Category:** Elasticsearch\
**Created:** [June 16, 2020, 7:43pm UTC](https://discuss.elastic.co/t/terms-query-not-working-as-expected/237357 "2020-06-16T19:43:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![denis\_ritchie](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/denis_ritchie/32/48235_2.png) [@denis\_ritchie](https://discuss.elastic.co/u/denis_ritchie)\
**Post date:** [June 16, 2020, 7:43pm UTC](https://discuss.elastic.co/t/terms-query-not-working-as-expected/237357/1 "2020-06-16T19:43:22Z")

</div>

Below is terms query with \_msearch. But its not giving all result.As of now, it only return result for

**4161** even though data exists for 4402 as well.

please look suggest solution.

```auto
GET _msearch
{ "index": ["index1", "index2", "index3"]}
{"query": {"terms": {"user_id": [4161,4402] } }}

```

---

<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:** [July 14, 2020, 7:43pm UTC](https://discuss.elastic.co/t/terms-query-not-working-as-expected/237357/2 "2020-07-14T19:43:28Z")

</div>

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