There is some index, that consists of such fields:
'index' => 'material',
'type' => 'post',
'id' => $post->id,
'body' => [
'material_title' => $post->material_title,
'material_body' => $post->material_body,
'region' => $post->region_code,
]
After that i have 2 input parameters: text query - for example "all good news today" and region code.
The search should be performed on 3 fields (material_title,material_body,region), one of which (region code) must be exactly the same.
My search params now:
$query = [
'multi_match' => [
'query' => $request->q,
'fuzziness' => 'AUTO',
'fields' => ['material_title', 'material_body'],
],
];
$parameters = [
'index' => 'material',
'size' => 20,
'from' => 0,
'type' => 'post',
'body' => [
'query' => $query
]
];
Can u give me some examples or advice how to realize this logic? Thanks!
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire