我试图在php代码中执行ElasticSearch查询,但出现以下错误:
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"}]
这是我的elasticsearch查询的aggs代码部分:
'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',
]
]
]
]
];
也许我没有正确筑巢?
1条答案
按热度按时间hxzsmxv21#
尝试删除
aggs
从查询的这部分新查询应如下所示:
由于我不了解您的用例,您甚至可以尝试将查询格式化为以下格式: