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


(Paddy Mahadeva) #1

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