[英]Failed to filter and delete old indices of elasticsearch using curator python API
I'm trying to use curator python API to periodically delete old logs in elasticsearch. 我正在尝试使用策展人python API定期删除elasticsearch中的旧日志。 In my code output, it seems I can't filter the indices I want which stuck me several days. 在我的代码输出中,似乎我无法过滤需要几天的索引。 Anyone can help to have a look if I have done anything wrong? 如果我做错了任何人,可以帮忙看看吗? I used elasticsearch-curator version 5.4.1 and tested elasticsearch 5.5 on EC2, aws elasticsearch 5.5 and aws elasticsearch 6.0 and the results are the same. 我使用elasticsearch-curator版本5.4.1,并在EC2,aws elasticsearch 5.5和aws elasticsearch 6.0上测试了elasticsearch 5.5,结果是相同的。
Following is my code: 以下是我的代码:
from elasticsearch import Elasticsearch
import elasticsearch
import curator
def handler():
client = elasticsearch.Elasticsearch(['http://XX.153.17.133:9200'])
ilo = curator.IndexList(client)
print ilo.all_indices
print ilo.filter_by_regex(kind='prefix', value='mov')
print ilo.filter_by_age(source='creation_date', direction='older', unit='seconds', unit_count=2)
#delete_indices = curator.DeleteIndices(ilo)
#delete_indices.do_action()
return
handler()
And following is the output: 以下是输出:
/Users/junyu/PycharmProjects/es-curator/bin/python
/Users/junyu/PycharmProjects/es-curator/es-curator.py
[u'movie']
None
None
Process finished with exit code 0
Thank you in advance! 先感谢您!
You will only see output from your print ilo.filter*
lines if you have logging set up. 如果已设置日志记录,则只会看到print ilo.filter*
行的输出。
If you want to see what indices remain after the filters, then try print ilo.indices
, as that is the working list. 如果要查看过滤器后面还剩下什么索引,请尝试print ilo.indices
,因为这是工作列表。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.