# Terms query is not working in Elasticsearch 7.1.0 and 7.2.0

**URL:** <https://discuss.elastic.co/t/terms-query-is-not-working-in-elasticsearch-7-1-0-and-7-2-0/189749>\
**Category:** Elasticsearch\
**Created:** [July 10, 2019, 11:56am UTC](https://discuss.elastic.co/t/terms-query-is-not-working-in-elasticsearch-7-1-0-and-7-2-0/189749 "2019-07-10T11:56:09Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [July 10, 2019, 3:16pm UTC](https://discuss.elastic.co/t/terms-query-is-not-working-in-elasticsearch-7-1-0-and-7-2-0/189749/8 "2019-07-10T15:16:07Z")

</div>

Please format your code, logs or configuration files using `</>` icon as explained in [this guide](https://discuss.elastic.co/t/about-the-elasticsearch-category/21) and not the citation button. It will make your post more readable.

Or use markdown style like:

````
```
CODE
```

````

This is the icon to use if you are not using markdown format:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/7/e/7e6e239431ec2d71cbf1beef741f2e93e7cc762c.jpg)

There's a live preview panel for exactly this reasons.

Lots of people read these forums, and many of them will simply skip over a post that is difficult to read, because it's just too large an investment of their time to try and follow a wall of badly formatted text.  
If your goal is to get an answer to your questions, it's in your interest to make it as easy to read and understand as possible.  
Please update your post.

> [@KRISHNA\_SINHA](#):
>
> Why is searching CM5 when I give search criteria as cm5 and not as CM5?

Because you are using a `term` query on a `text` field which is analyzed at index time and probably transform to `cm5`. `CM5` is not `cm5` that's why a term query can't find `CM5`.  
You need to change the mapping of you want to make it work with `CM5`.

---

_[View the full topic](https://discuss.elastic.co/t/terms-query-is-not-working-in-elasticsearch-7-1-0-and-7-2-0/189749)._
