1

I'm trying to use curator python API to periodically delete old logs in 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.

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!

4

1 回答 1

0

print ilo.filter*如果您设置了日志记录,您只会看到您的线路的输出。

如果您想查看过滤器后剩余的索引,请尝试print ilo.indices,因为这是工作列表。

于 2018-01-29T15:17:01.717 回答