Apply filter for each match clause

Hi ,
I am using Elastic search 5.1 and I have built two indexes say brand and products index . I do a search on the brand index using these fields
1.Brand
2.Brand extension
3. Local brand .
I take top 10 results from the brand query and used as the filter for the products index search
For each brand result I am sending a query to products index Hence I am doing 10 searches on the products index and getting top 10 for every request . which returns 100 documents in total

How to combine all the 10 search query into a single search query ?

Say I have these two results from brand query as

Result 1

  1. BRAND =PEPSI
  2. LOCALBRAND =PEPSI
  3. BRANDEXT=DIET PEPSI
    Result 2
  4. BRAND =PEPSI123
  5. LOCALBRAND =PEPSI COMPANY
  6. BRANDEXT=DIET PEPSI234

How do I modify this below filter query ? i.e for the same match clause I have to apply result 1 combination and result2 combination as the filters

{
"query": {
"bool": {
"should": {
"match": {
"ITEMDESCRIPTION": "COCA COLA 1 liter BOTEL"
}
},
"filter": [
{
"term": {
"BRANDEXT": "DIET COKE "
}
},
{
"term": {
"LOCALBRAND": "COKE"
}
},
{
"term": {
"BRAND": "COCA COLA"
}
}
]
}
}
}

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.