title: Elasticsearch index cleanup
body: <p>v Elasticsearch 5.6.*.</p>
  
  <p>I'm looking at a way to implement a mechanism by which one of my index (that grows big in no time about 1 million documents per day) to manage the storage constraints automatically.</p>
  
  <p>For example: I will define the max no of documents or max index size as a variable 'n'.
  I'd write a scheduler that checks whether 'n' is true. If true, then I'd want to delete the oldest 'x' documents (based on time).</p>
  
  <p>I have a couple of questions here:</p>
  
  <p>Apparently, I do not want to delete too much or too less. How would I know what 'x' is? Can I simply say to elasticsearch that "Hey delete the oldest documents worth 5GB" -  My intent is to simply free up a fixed amount of storage. Is this possible?</p>
  
  <p>Secondly, I'd want to know what's the best practice here? Obviously I don't want to invent a square wheel here and if there's anything (eg: Curator and I've been hearing about it only recently) that does the job then I'd be happy to use it.</p>