I am planning to turn my search and filtering engines into Elasticsearch. By looking into a lot documentation I found that elasticsearch has the ability create facets. I made some facets into my left filter navigation sidebar and query my products and facets by filtering them using category field in elasticsearch.
But the thing is I don't know how to query back into elasticsearch for selected facets.
I used
'filter' => [
'bool' => [
'must' => [
['match_phrase' => [ 'Material' => 'Aluminum' ]],
['match_phrase' => [ 'Length' => '1/2']]
]
]
]
this code in body tag of elasticsearch php client. It actually works but I have other products that has Length 1/2-3 or 1/2-4. When I queried for 1/2, Elastic also gets 1/2-3 and 1/2-4 because '1/2-3' and '1/2-4' contains also '1/2'.
I wonder how to search and get exactly products that have 1/2 not 1/2-3 or 1/2-4 what query should I have to use exactly?
Thanks!
Note : Facets are deprecated I know. I am using that word because I am used to it. It's now aggregations in Elasticsearch 2.3. and I am using that version.*