[英]How to iterate through every object in an ElasticSearch index?
This should be easy. 这应该很容易。
I've inserted a number of records into ElasticSearch and have been scouring their documentation but I can't seem to find a way to simply take an index and iterate through it in Node.js 我已经在ElasticSearch中插入了许多记录,并且一直在搜索它们的文档,但是我似乎找不到一种简单的方法来获取索引并在Node.js中对其进行遍历
I don't have much experience with Elastic, so it's been frustrating. 我在Elastic方面没有太多经验,所以令人沮丧。
Some of the items in that list need to be pruned more or less on a 10 minute basis, otherwise the DB just grows and grows. 该列表中的某些项目需要在10分钟的时间内或多或少地被修剪,否则数据库会不断增长。 I'd like a separate task to do just that.
我想要一个单独的任务来做到这一点。
You can achieve what you want by using a range
query in your delete by query call: 您可以在查询删除操作中使用
range
查询来实现所需的目标:
POST your_index/_delete_by_query
{
"query": {
"range" : {
"date_field" : {
"lt" : "2017-05-08T00:00:00.000Z"
}
}
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.