I have a multi-match query in ES, and wish to add a filter.
{
\"multi_match\" : {
\"query\" : \"this is a test\",
\"fields\" : [ \"subject^2\", \"messa
Try this:
[
"index" => 'shop_1', //index_name,
"type" => 'shop', //type_name,
"from" => 0, //offset
"size" => 30, //limit
"body" => [
"query" => [
"bool" => [
"must" => [
"match" => [
"category" => 'men' // results must contain 'men' in category field
]
]
]
],
"_source" => [ // fields to retrieve
"id",
"product_id",
"item_title",
"item_slug",
"item_sku"
],
"sort" => [
[
"_score" => [
"order" => "desc" // order by score desc
]
]
]
],
];