# Search for documents with 50% exactly matched phrases in string using Elasticsearch

**URL:** <https://discuss.elastic.co/t/search-for-documents-with-50-exactly-matched-phrases-in-string-using-elasticsearch/177047>\
**Category:** Elasticsearch\
**Created:** [April 16, 2019, 9:45am UTC](https://discuss.elastic.co/t/search-for-documents-with-50-exactly-matched-phrases-in-string-using-elasticsearch/177047 "2019-04-16T09:45:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Paddy\_Mahadeva](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/paddy_mahadeva/32/44225_2.png) [@Paddy\_Mahadeva](https://discuss.elastic.co/u/Paddy_Mahadeva)\
**Post date:** [April 16, 2019, 9:45am UTC](https://discuss.elastic.co/t/search-for-documents-with-50-exactly-matched-phrases-in-string-using-elasticsearch/177047/1 "2019-04-16T09:45:41Z")

</div>

Hi,

I have a use case where I need to find all documents with a 100% phrase match of at least 50% of my input phrases

# Eg: my text

situation is under control now, system pledges to rebuild

# Sentences am trying to match

system pled ges to re build (should not match)  
situation is under control to rebuild (should match)  
situaton was under contol to re build (should not match)  
situation is under control now, system pledges to rebuild (should match)  
situation is not as good as we can rebuild (Should not match)  
system pledges to rebuild, situation is (should match) (edited)  
rebuild system pledges to. (should match)

Currently I am using query string to do the same  
{  
"query\_string": {  
"query": "situation is under control now, system pledges to rebuild",  
"minimum\_should\_match": "100%",  
"type": "phrase",  
"fields": [  
"notice\_off"  
]  
}  
}

How do I achieve this?

Thanks

---

<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:** [May 14, 2019, 9:45am UTC](https://discuss.elastic.co/t/search-for-documents-with-50-exactly-matched-phrases-in-string-using-elasticsearch/177047/2 "2019-05-14T09:45:42Z")

</div>

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