I have one problem regarding elastic search, I want to search the exact match in the filters. For example, If the color filter is applied only "Black" then the elastic search should be returned only "Black" products instead of other products which have Black keywords in their product color like "Black grey". I have tried "match_phrase" instead of "match" but couldn't get anything.
Please check the screenshot of my JSON string: https://www.screencast.com/t/wjCcpfQwTxw
Thanks in advance
You can user term query.
For example:
GET {Your index}/_search
{
"query": {
"term": {
"color.keyword": {
"value": "Black"
}
}
}
}
It will return the documents which 'color' field equals to Black.If your color field is text type.Remember add '.keyword' after it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With