[英]Using Logstash to delete an index from ES
我想先從ES
刪除索引,然后再從MySQL
上傳數據的更新版本。 從今天開始,我使用curl刪除數據,並使用Logstash上傳,但是我想知道是否有一種方法可以不必手動分離,最好的情況是可以使用Logstash(及其調度程序)來進行操作全自動。 說有沒有辦法在我的配置文件中簡單地寫一些東西來做到這一點?
我今天如何刪除:
curl -X -DELETE 'http://localhost:9200/index'
之所以要在上傳新數據之前刪除索引,是因為我要上傳來自各種來源的數據,因此決定何時更新數據的能力並不那么容易。 這就是為什么我選擇在上傳更新版本之前刪除數據的原因。 如果有更聰明的方法來解決此問題,我希望聽到它。
您可以創建一個批處理文件,以同時運行logstash進程和策展人操作。
按照說明下載並安裝策展人 。 使用策展人命令行對索引執行操作。 要刪除,請檢查“ 刪除索引”操作。
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.