我正在尝试获取与特定字段匹配的 2 个日期之间的记录,如下所示
{
"query": {
"bool": {
"must": [
{
"range": {
"createdtime": {
"gte": "now-1y",
"lte": "now",
"boost" : 2.0
}
}
},
{
"match": {
"id": 350403
}
}
]
}
}
"size" : 10000,
"from": 0,
"sort": { "createdtime" : {"order" : "desc"} }
但是它抛出异常,谁能帮忙修复一下?
最佳答案
您应该正确地格式化和缩进您的查询,这样更容易发现错误。可以在下面找到正确的查询:
{
"query": {
"bool": {
"must": [
{
"range": {
"createdtime": {
"gte": "now-1y",
"lte": "now",
"boost": 2
}
}
},
{
"match": {
"id": 350403
}
}
]
}
},
"size": 10000,
"from": 0,
"sort": {
"createdtime": {
"order": "desc"
}
}
}
关于elasticsearch - 匹配无效的 Elasticsearch 日期范围,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51628742/