SELECT * FROM products WHERE (stock_code = '1234' AND category_code = '3214') OR (stock_code = '1234' AND category_code = '3214')
Also I want named query to be used bcz in the result matched query is needed
I have this now
$params['body']['query']['bool']['must']['bool']['should'][]=[
'match' => [
'stock_code' => [
'query' => $val->stock_code,
'_name' => $val->stock_code,
],
]
];
You need do it this way using two
bool/filter(i.e. inner AND) inside abool/should(i.e. outer OR):