PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Monday, October 24, 2022

[FIXED] How to set a TTL for an index in ElasticSearch

 October 24, 2022     .net, c#, elasticsearch, nest     No comments   

Issue

I would like to know how can I set a TTL so that each document older than 30 days are automatically removed by the ES cluster.

I know previous versions used to manage this using the TTL field but it seems it is removed now.

I'm using NEST.NET 6.4.0


Solution

TTL was removed in 5.0

you can use curator , shedule it as cronjob or jenkins job , and delete old indices all together.

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"}]'

See also:

Is there a way to Set ttl in elastic search index



Answered By - Ijaz Ahmad
Answer Checked By - Marilyn (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing