【发布时间】:2021-08-21 14:48:32
【问题描述】:
大家好,我正在使用 Elastic Search 检索数据。我收到如下错误:-
{
"error": {
"root_cause": [
{
"type": "parsing_exception",
"reason": "[bool] query does not support [minimum_number_should_match]",
"line": 1,
"col": 396
}
],
"type": "parsing_exception",
"reason": "[bool] query does not support [minimum_number_should_match]",
"line": 1,
"col": 396
},
"status": 400
}
为此我编写了代码:
{
"_source": [
"ch",
"text",
"title",
"d_name"
],
"track_scores": true,
"sort": [
"_score"
],
"size": 50,
"from": 0,
"query": {
"bool": {
"should": [
{
"match_phrase": {
"text": {
"query": "xxx",
"slop": 5
}
}
},
{
"match_phrase": {
"title": {
"query": "xxx",
"slop": 0,
"boost": 9
}
}
},
{
"match_phrase": {
"ch": {
"query": "xxxx",
"slop": 0,
"boost": 15
}
}
}
],
"minimum_number_should_match": 1,
"filter": {
"bool": {
"should": [
{
"term": {
"d_name": "The Central"
}
}
]
}
}
}
}
}
它在旧版本上运行良好,但在新版本上无法运行。如果我删除“minimum_number_should_match”,那么它会给出不正确的结果,如果我使用“minimum_should_match”,那么它会给我那些找不到查询值的记录。
【问题讨论】:
-
应该是
minimum_should_match
标签: php amazon-web-services elasticsearch