elasticsearch,nest,C#,.net,elasticsearch,Nest" /> elasticsearch,nest,C#,.net,elasticsearch,Nest" />

C# 如何在ElasticSearch中为索引设置TTL

C# 如何在ElasticSearch中为索引设置TTL,c#,.net,elasticsearch,nest,C#,.net,elasticsearch,Nest,我想知道如何设置TTL,以便ES群集自动删除每个超过30天的文档 我知道以前的版本使用TTL字段来管理它,但现在它似乎被删除了 我正在使用NEST.NET 6.4.0,TTL在5.0中被删除 您可以使用curator,将其安排为cronjob或jenkins job,并一起删除旧索引 curator_cli --host localhost --port 9200 --http_auth "$USER":"$PASS" \ delete_indices --ignore_empty_list

我想知道如何设置TTL,以便ES群集自动删除每个超过30天的文档

我知道以前的版本使用TTL字段来管理它,但现在它似乎被删除了

我正在使用NEST.NET 6.4.0,TTL在5.0中被删除

您可以使用curator,将其安排为cronjob或jenkins job,并一起删除旧索引

curator_cli --host  localhost --port 9200 --http_auth "$USER":"$PASS" \
delete_indices --ignore_empty_list --filter_list '[{"filtertype":"age","source":"creation_date","direction":"older","unit":"days","unit_count":30}, \
{"filtertype":"pattern","kind":"prefix","value":"livelogs"}]'
另见:

这个答案可能会有帮助: