I am newbie with elastic search and have trouble with following scenario:
- Let's consider I have 2 documents which contains only one field "text"
- "text" : "token1 token4"
- "text" : "token2 token3"
- "text" : "token4 token5"
- And by following query-text "token1 token2 token3 token4 token5" I want to find only documents 2 and 3
I need something similar to shingles filter which will create following tokens from query:
["token1 token2", "token2 token3", "token3 token4", "token4 token5"]
And will make exact match by these tokens, so tokens "token2 token3" and "token4 token5" will match document
Thanks in advance!
This can be done by using shingle filter and making output_unigrams false(It will prevent generation of single token). Create your index like this
Index some sample documents.
Then simple match query will give you the desired result.