# Should Inside Must

**URL:** https://discuss.elastic.co/t/should-inside-must/237095
**Category:** Elasticsearch
**Created:** [June 15, 2020, 8:56am UTC](https://discuss.elastic.co/t/should-inside-must/237095 "2020-06-15T08:56:42Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![prvn\_prasher](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/prvn_prasher/32/70365_2.png) [@prvn\_prasher](https://discuss.elastic.co/u/prvn_prasher)
#### Post date: [June 15, 2020, 8:56am UTC](https://discuss.elastic.co/t/should-inside-must/237095/1 "2020-06-15T08:56:42Z")

</div>

I am trying to create a query like  
Simply, I am trying to recreate this SQL query:  
`SELECT * FROM test where com_ref= 'ddfdfdfdf' and (fr_id = 511168 or fr_id = 511258 )`.  
`{ "query": { "bool": { "filter": { "bool": { "must": [{ "match_phrase": { "com_ref": "ddfdfdfdf" } }, { "bool": { "should": [ { "term": { "fr_id ": 511168 } }, { "term": { "fr_id ": 511258 } }] } } ] } } } } }`

But it's not getting any results I don't know what I am missing.  
Also i need a working solution with filter context

---

<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 13, 2020, 8:56am UTC](https://discuss.elastic.co/t/should-inside-must/237095/2 "2020-07-13T08:56:43Z")

</div>

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