gpt4 book ai didi

elasticsearch - 我的Elasticsearch查询出了什么问题?

转载 作者:行者123 更新时间:2023-12-02 22:48:07 25 4
gpt4 key购买 nike

我需要一次进行multi_match和bool查询,但是下面的查询不起作用:(当我使用它们separatley时,它们可以完美地工作。

{
"query": {
"multi_match": {
"query": "kotlety*",
"fields": [
"name"
]
},
"bool": {
"filter": {
"term": {
"status": 2
}
}
}
},
"size": 24
}

响应是:
{
"error": {
"root_cause": [
{
"type": "parsing_exception",
"reason": "[multi_match] malformed query, expected [END_OBJECT] but found [FIELD_NAME]",
"line": 9,
"col": 5
}
],
"type": "parsing_exception",
"reason": "[multi_match] malformed query, expected [END_OBJECT] but found [FIELD_NAME]",
"line": 9,
"col": 5
},
"status": 400
}

flex 6.6,我认为我的查询语法可能错误?

最佳答案

该查询不能同时包含bool和multi_match。您可以这样重新排列:

{
"query": {
"bool": {
"filter": {
"term": {
"status": 2
}
},
"should": {
"multi_match": {
"query": "kotlety*",
"fields": [
"name"
]
}
}
}
},
"size": 24
}

关于elasticsearch - 我的Elasticsearch查询出了什么问题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55336153/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com