gpt4 book ai didi

elasticsearch - 以下 Elasticsearch 查询有什么问题?

转载 作者:行者123 更新时间:2023-12-03 00:40:17 26 4
gpt4 key购买 nike

我想在标题和正文上搜索全文,并在答案计数上进行过滤。
我阅读了elasticsearch documentation for combining filters并构建了此查询。

"query": {
"bool": {
"minimum_should_match": "25%",
"should": [
{
"query_string": {
"query": "elasticsearch",
"analyze_wildcard": "True",
"fields": [
"body"
]
}
},
{
"query_string": {
"query": "test",
"analyze_wildcard": "True",
"fields": [
"title"
]
}
}
]
},
"constant_score": {
"filter": {
"query": {
"bool": {
"must": [
{
"range": {
"answer_count": {
"gte": 0,
"lte": 0
}
}
}
]
}
}
}
}
}
}

它一直给我这个错误。
 RequestError: TransportError(400, u'parsing_exception', u'no [query] registered for [filter]')

最佳答案

您需要这样写:

{
"query": {
"bool": {
"minimum_should_match": "25%",
"should": [
{
"query_string": {
"query": "elasticsearch",
"analyze_wildcard": "True",
"fields": [
"body"
]
}
},
{
"query_string": {
"query": "test",
"analyze_wildcard": "True",
"fields": [
"title"
]
}
}
],
"filter": [
{
"range": {
"answer_count": {
"gte": 0,
"lte": 0
}
}
}
]
}
}
}

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

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