【发布时间】:2023-03-31 02:40:01
【问题描述】:
我想了解一下 elasticsearch 7.x 中的查询。
我可以将我的查询转换为一周的特定时间范围吗?
=> 例如)7 天内每天早上 8 点到下午 3 点
现在我的查询(仅 7 天):
"query": {
"bool": {
"must": [
{
"range": {
"statusAt": {
"format": "strict_date_optional_time",
"gte": "2019-11-04T02:54:28.625Z",
"lte": "2019-11-11T02:54:28.625Z"
}
}
}
]
}
}
【问题讨论】:
-
这个答案可能会有所帮助:stackoverflow.com/a/33537029/4604579
-
@Val 我已经看过了。但我不能那样使用它。错误消息是
"[script] query does not support [params]" -
那是旧版本的 ES。我修改了答案以使其适用于最新版本,请重试
-
@Val 我把它改成了你的答案。但错误消息是
"Variable [min] is not defined." -
好吧,缺少参数,再试一次。
标签: elasticsearch