【发布时间】:2021-06-06 05:48:39
【问题描述】:
开始在 ES 上工作。我希望能够使用 PHP 中的过滤器进行 multi_match。我遵循了官方 ES 文档,但我不明白我的错误。
代码如下:
public function search_data_into_index($array)
{
$params = [
'index' => 'skills',
'type' => 'people',
'body' => [
'query' => [
'multi_match' => [
'query' => 'react',
'fields' => [$array[2]],
'fuzziness' => 'AUTO',
],
'filter' => [
'geo_distance' => [
'distance' => '300m',
'location' => '-25, -49'
]
]
]
]
];
$response = $this->client->search($params);
print_r($response);
}
这是我的错误:
{"error":{"root_cause":[{"type":"parsing_exception","reason":"[multi_match] malformed query, expected [END_OBJECT] but found [FIELD_NAME]","line":1,"col":94}],"type":"parsing_exception","reason":"[multi_match] malformed query, expected [END_OBJECT] but found [FIELD_NAME]
【问题讨论】:
标签: php json elasticsearch