gpt4 book ai didi

json - Elasticsearch查询在 bool 值中使用范围时引发错误

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

我正在使用status fieldrange查询 flex 搜索,但出现错误:

"type": "parsing_exception","reason": "[status] query malformed, no start_object after query name"



查询如下:
{
"_source": {
"includes": []
},
"query": {
"bool": {
"must": [
{
"status": "IN_PROGRESS"
},
{
"range": {
"requestDate": {
"gte": "2018-10-01T08:00:00.000Z",
}
}
}
]
}
},
"sort": {
"requestDate": {
"order": "desc"
}
}
}

最佳答案

错误是您尚未针对状态字段指定查询类型-术语或匹配。因此,如果status是文本数据类型,则应执行匹配查询:

{
"_source": {
"includes": []
},
"query": {
"bool": {
"must": [
{
"match":{ "status": "IN_PROGRESS"
}},
{
"range": {
"requestDate": {
"gte": "2018-10-01T08:00:00.000Z",
}
}
}
]
}
},
"sort": {
"requestDate": {
"order": "desc"
}
}

}

关于json - Elasticsearch查询在 bool 值中使用范围时引发错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59632986/

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