[英]Using Logstash to delete an index from ES
I want to delete an index from ES
before uploading a updated version of the data from MySQL
. 我想先从ES
删除索引,然后再从MySQL
上传数据的更新版本。 As of today I use curl to delete the data and Logstash to upload, however I was wondering if there is a way where I do not have to do it manually separated, best case being able to use Logstash (with its scheduler) to have it fully automatic. 从今天开始,我使用curl删除数据,并使用Logstash上传,但是我想知道是否有一种方法可以不必手动分离,最好的情况是可以使用Logstash(及其调度程序)来进行操作全自动。 Say is there a way to simply write something in my config-file to do this? 说有没有办法在我的配置文件中简单地写一些东西来做到这一点?
How I´m deleting today : 我今天如何删除:
curl -X -DELETE 'http://localhost:9200/index'
The reason to why I am deleting the index before uploading new data is because I am uploading data that is coming from various sources, hence the ability to decide when the data was updated is not that easy. 之所以要在上传新数据之前删除索引,是因为我要上传来自各种来源的数据,因此决定何时更新数据的能力并不那么容易。 This is why I have chosen to delete the data before uploading a updated version. 这就是为什么我选择在上传更新版本之前删除数据的原因。 If there is a smarter way to approach this problem I would love to hear it. 如果有更聪明的方法来解决此问题,我希望听到它。
You can create a batch file that runs the logstash process and curator actions together. 您可以创建一个批处理文件,以同时运行logstash进程和策展人操作。
Download and install curator using the instructions. 按照说明下载并安装策展人 。 Use curator command line to perform actions on indices. 使用策展人命令行对索引执行操作。 For deletion, check out Delete Indices action. 要删除,请检查“ 删除索引”操作。
action: delete_indices
description: >-
Delete indices older than 45 days (based on index name), for logstash-
prefixed indices. Ignore the error if the filter does not result in an
actionable list of indices (ignore_empty_list) and exit cleanly.
options:
ignore_empty_list: True
disable_action: True
filters:
- filtertype: pattern
kind: prefix
value: %{Index_Name}
- filtertype: age
source: name
direction: older
timestring: '%Y.%m.%d'
unit: days
unit_count: 45
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.