Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to delete data in an ES index

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

How to delete the data in the ES index? In view of this problem, today, the editor summarizes this article with a detailed explanation of the picture and text. Friends in need can refer to it. I hope it will be helpful to you.

The following script, I looked for 2 days, according to the online documentation, also modified 2 days. Just recently began to learn shell for the third time, and found that combined with shell knowledge, it is still very effective to solve problems.

With the following script, you can delete the ES data from 200 days ago.

[root@iZ23ejm6lkdZ ~] # cat / yqd query: {"range": {"bank_interfacelog_createTime": {"gte": "now-200d" "lte": "now", "format": "epoch_millis"}}'# echo "cleared 200 days ago data in the $index index ~"

The third column is "10.253.40.87 9200": ES address

"yqdlog" of the third column: index name

"bank_interfacelog_createTime" in the seventh column: specify the time field to delete

The "now-200d" in the eighth column: the time range for deleting data, "- 200d", that is, deleting data from 200 days ago.

Column 10: default, or customizable

Execute the script:

[root@iZ23ejm6lkdZ ~] # sh/ yqd/sh/Clean_Elasticsearch_Yqdlog.sh {"took": 2382512, "timed_out": false, "total": 8817667, "deleted": 8817667, "batches": 8818, "version_conflicts": 0, "noops": 0, "retries": {"bulk": 0, "search": 0}, "throttled_millis": 0 "requests_per_second":-1.0," throttled_until_millis ": 0," failures ": []}

During the execution of the script, ES's head plug-in shows a significant downward trend in "yqdlog" index data, but the disk space monitored by zabbix has a larger footprint.

Online documents say that the deletion of ES will not take effect immediately and will be deleted automatically at a later stage. This problem needs to be studied.

When you look at zabbix the next day, disk space seems to have dropped.

The above is the introduction of the method of deleting data in the ES index, and you have to use it to know the specific essentials. If you want to know more about it, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report