I am trying to execute an Elastic Search query in my php code but I get this error:
Uncaught PHP Exception Elasticsearch\Common\Exceptions\BadRequest400Exception:
"{"error":{"root_cause":[{"type":"named_object_not_found_exception","reason":"[1:834]
unable to parse BaseAggregationBuilder with name [highlight_properties]: parser not found"}]
This is my aggs code part of my ElasticSearch query:
'aggs' => [
'highlight_dealers' => [
'terms' => [
'field' => 'sorting.Id',
'size' => 4
]
],
'aggs' => [
'highlight_properties' => [
'terms' => [
'field' => '_id',
'size' => 2,
],
'aggs' => [
'property' => [
'top_hits' => [
'size' => 1
]
],
'randomProperty' => [
'max' => [
'script' => [
'source' => 'new Random().nextInt()',
'lang' => 'painless'
]
]
]
]
],
'randomDealer' => [
'avg' => [
'script' => [
'source' => 'Math.sin(109813 * doc["sorting.id"].value)',
'lang' => 'painless',
]
]
]
]
];
Am I not nesting correctly maybe?