我有一个弹性搜索索引,可以在大转储中获取新数据,因此从图表中可以看出,添加新数据时非常明显。

如果我只想从最近的摄取中获取数据(在这种情况下是 2020-08-06 的数据,那么最好的方法是什么?
我可以使用此查询来获取最新的文档:
GET /indexname/_search
{
"query": {
"bool": {
"must": [
{
"query_string": {
"query": queryString
}
}
]
}
},
"sort": {
"@timestamp" : "desc"
},
"size": 1
}
Which will return the most recent document, in this case a document with a timestamp of 2020-08-06. I can set that to my endDate and set my startDate to that date minus one day, but im worried of cases where the data was ingested overnight and spanned two days.
我可以继续请求一次 5 小时返回时间以查找最近的大差距是什么时候,但我担心在 for 循环中发出请求可能会很耗时?有没有更聪明的方法来获取我最近摄取的日期范围?thx