gpt4 book ai didi

elasticsearch - 弹性查询以搜索术语并在日期范围内

转载 作者:行者123 更新时间:2023-12-02 23:16:32 28 4
gpt4 key购买 nike

GET _search
{
"query": {
"bool":{
"filter":{
"and":[
{
"term":{
"Server": "XYZ"
},
"range": {
"DateTime":{
"from": "2018-12-13T00:20:48.782Z",
"to":"2018-12-14T00:20:48.782Z"
}
}
}
]
}}
}
}

上面是我的 flex 查询,用于获取属于 XYZ服务器的所有记录,并且在该时间范围内,我的数据集中有 ServerDateTime列,但抛出以下错误:

{ "error": { "root_cause": [ { "type": "parsing_exception", "reason": "[term] malformed query, expected [END_OBJECT] but found [FIELD_NAME]", "line": 9, "col": 11 } ], "type": "parsing_exception", "reason": "[term] malformed query, expected [END_OBJECT] but found [FIELD_NAME]", "line": 9, "col": 11 }, "status": 400 }



我在这里想念什么!

最佳答案

您的查询格式错误,请改用以下查询:

GET _search
{
"query": {
"bool": {
"filter": [
{
"term": {
"Server": "XYZ"
}
},
{
"range": {
"DateTime":{
"from": "2018-12-13T00:20:48.782Z",
"to": "2018-12-14T00:20:48.782Z"
}
}
}
]
}
}
}

关于elasticsearch - 弹性查询以搜索术语并在日期范围内,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54144011/

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