Consider following document:
{ "Title": "Western Europe" }
I'd like to run such search queries against Title field
- Apple in Western Europe
- Apple in Eastern Europe
I could run a simple match query:
POST /_search { "query": { "match": { "Title": "Apple in Western Europe" } } }
It obiviously would match and bring it back irregardless of which search phrase I'd use. But I'd like to make a query that would bring my document back only if Title field phrase matches my search query. Is that possible? Are there any additional parameters? It seems like a reverse case for phrase matching.
If not, should I consider reindexing my data with shingles?
So in this scenario running this (with additional parameters) wouldn't score and bring back my document.
POST /_search { "query": { "match": { "Title": "Apple in Eastern Europe" } } }
tl;dr
How do I write a query that would bring back document if all of its field (the one I'm searching on) tokens are present in my search query? For instance my field in document contains these two tokens only:
- abc
- xyz
And if my search phrase is, for instance Lorem ipsum dolor sit amet, consectetur adipiscing elit abc xyz, document is brought back.
If it's Lorem ipsum dolor sit amet, consectetur adipiscing elit xyz, it's not brought back.