简体   繁体   English

使用策展人python API无法过滤和删除Elasticsearch的旧索引

[英]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.

相关问题 Elasticsearch(Elasticsearch Curator)Python API。 获取ES索引及其大小的字典 - Elasticsearch (Elasticsearch Curator) Python API. Get dictionary of ES indices and their sizes Python api 删除 -- elasticsearch - Python api to delete -- elasticsearch 如何使用elasticsearch python中的特定字段名称从多个索引中删除文档? - How to delete documents from multiple indices using particular field name in elasticsearch python? SSL:策展人访问 elasticsearch 时出现 CERTIFICATE_VERIFY_FAILED 错误 - SSL: CERTIFICATE_VERIFY_FAILED error when curator access elasticsearch Elasticsearch python API:通过查询删除文档 - Elasticsearch python API: Delete documents by query 使用python代码删除Unix中的旧文件 - Delete old files in unix using python code 使用python删除elasticsearch中的特定文档 - Delete specific docs in elasticsearch using python Elasticsearch:如何使用 python 删除索引 - Elasticsearch : How to delete an Index using python 使用python elasticsearch在AWS Elasticsearch上搜索失败,返回411 - Failed to search on AWS Elasticsearch using python elasticsearch returns 411 如何使用索引删除文本文件python中的特定行? - How to delete a specific line in text file python using indices?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM