Terms query is not working in Elasticsearch 7.1.0 and 7.2.0

Please format your code, logs or configuration files using </> icon as explained in this guide 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:

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.

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.