I'm trying to build a query in Elasticsearch
with PHP
combining an exact match and search by keywords/text. I'm using the should
for an exact match, and for text, I'm using the term
match.
My query is:
$params = [
'index' => 'sample-vehicles',
'body' => [
'query' => [
'bool' => [
'should' => [
['match' => ['abc_vehicle_code' => 'RR']],
['match' => ['fuel_type' => 'Diesel']],
['match' => ['manufacturer_city' => 'Chicago']]
],
'must' => [
['term' => ['res_street_1.keyword' => '2213']],
['term' => ['res_street_2.keyword' => 'Cermak Road']]
]
],
],
]
];
For an exact match sent in, the should
gives me appropriate results, but as soon as I place any street address, it gives me 0
records.