简体   繁体   English

使用Logstash从ES删除索引

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

Source - Delete Indices Example 来源-删除索引示例

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用logstash将索引数据从一个ES索引复制到另一个ES索引 - Copy index data from one ES index to ES another using logstash 如何从LOGSTASH创建索引并映射到ES - How to create Index and Mapping into ES from LOGSTASH “Block in Start_input”在使用 Logstash 将索引数据从 ES 下载到 CSV 文件时出现此错误 - "Block in Start_input" getting this error while downloading index data from ES to CSV file using Logstash logstash索引未将数据推送到ES - logstash index is not pushing data to ES logstash无法在ES中创建索引 - logstash fails to create an index in ES 带有 Elasticsearch 的 Logstash:我正在使用 logstash 将数据摄取到 ES 索引中。 但现在我希望logstash 24/7 运行 - Logstash with Elasticsearch: I am using logstash to ingest the data into the ES index. But now I want logstash to run 24/7 ELK logstash 无法在 ES 中创建索引 - ELK logstash cant create index in ES 如何在Rails应用中使用带有ES 2.X版本的delete_ by_query插件从索引中删除所有数据? - How to delete all data from an index using delete_ by_query plugin with ES 2.X versions in rails app? 没有使用logstash Logstash从couchdb创建索引 - Index not creating from couchdb with logstash Logstash 如何使用logstash将数组数据类型从mongodb索引到elasticsearch - How to index array data type from mongodb to elasticsearch using logstash
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM