Hi all,
Sorry for my bad English
I have a problem with hightlight query search.
$params['body'][] = [
'index' => [
'_index' => 'my_index',
'_type' => 'my_type',
]
];
$params['body'][] = [
'id' => 1,
'user' =>[
{
"name": "Nguyen Dinh",
"id": 2,
"language_id": 1
},
{
"name": "Trung Tuan",
"id": 2,
"language_id": 2
},
{
"name": "Trung Tuan",
"id": 2,
"language_id": 1
},
];
$jResult = $client->search([
'index' => 'search',
'type' => 'printers',
'body' => [
'query' => [
'multi_match' => [
'query' => 'Tuan',
'type' => 'cross_fields',
'fields' => [ 'id', 'user.name']
]
],
'highlight' => [
'fields' => [
'id' => new \stdClass(),
'user.name' => new \stdClass(),
]
]
]
]);
Result highlight in hits
"highlight":{
'user.name' => [
'Trung <tag>Tuan</tag>',
'Trung <tag>Tuan</tag>'
]
}
How I know
+ Trung <tag>Tuan</tag>
with language_id 2
+ Trung <tag>Tuan</tag>
with language_id 1
or custom result highlight.
Thanks a lot.