Hi. I'm totally new in ElasticSearch. I'm using "Yii2 Framework" and stalked on. Elastic not works with nested field. Is here specialist in Yii2 & Elasticsearch? Or where I can find the answer? Documents in index are like this:
{
"id" : 28,
"name" : "Futura Door",
"description" : "Futura Door",
"code" : "7339",
"price" : 14924,
"values" : {
"type" : "nested",
"properties" : [
{
"characteristic" : 1,
"value_string" : "Grey",
"value_int" : 0
},
{
"characteristic" : 2,
"value_string" : "Futura",
"value_int" : 0
}
]
}
}
Query is made with framework like this:
'query' => [
'bool' => [
'must' => array_merge(
array_filter([
!empty($form->text) ? ['multi_match' => [
'query' => $form->text,
'fields' => ['name^2', 'description']
]] : false,
]),
array_map(function (Value $value) {
return ['nested' => [
'path' => 'values',
'query' => [
'bool' => [
'must' => array_filter([
['match' => ['values.characteristics' => $value->getId()]],
!empty($value->equal) ? ['match' => ['values.value_string' => $value->equal]] : false,
!empty($value->from) ? ['range' => ['values.value_int' => ['gte' => $value->from]]] : false,
!empty($value->to) ? ['range' => ['values.value_int' => ['lte' => $value->to]]] : false,
]),
],
],
]];
}, array_filter($form->values, function (ValueForm $value) {
return $value->isFilled();
}))
)
],
],