我正在使用status field
和range
查询 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/