1

I have a ILM policy which rollover lets say after "max_docs": 15000. Meaning rollover the index once the docs.count reaches to 15000.

{
    "policy": {
        "phases": {
            "hot": {
                "actions": {
                    "rollover": {
                        "max_docs": 15000
                    }
                }
            },
            "delete": {
                "min_age": "1d",
                "actions": {
                    "delete": {}
                }
            }
        }
    }
}

Rollover is also happening when I bootstrap the initial index index-2022-07-02-00001 and appending the new date for next date to the index like :

index-2022-07-02-00002 
index-2022-08-02-00003
index-2022-08-02-00004

and so.

Now I want to create the new index for each day but the index pattern should also start from 00001 meaning :

index-2022-07-02-00001
index-2022-07-02-00002
index-2022-08-02-00001 - For next day the pattern (00001) should be applied instead of (00003)

Please suggest a way to apply this kind of pattern.

Paulo
  • 8,690
  • 5
  • 20
  • 34
I'm_Pratik
  • 541
  • 8
  • 22
  • You cannot resume the sequence id, it will always increase by 1 on each rollover. – Val Feb 07 '22 at 10:23
  • Agreed @Val but looking out for a way I can achieve the scenario – I'm_Pratik Feb 08 '22 at 05:48
  • @Val what will happen when it will reach the max value (i.e 00001 to 99999) ? Does it start from 00001 again? – I'm_Pratik Feb 17 '22 at 05:31
  • 2
    The sequence number is [padded with 0's up to 6 figures](https://github.com/areek/elasticsearch/blob/4e3602a79062807bdea6ea3dc18c8918ec649af9/core/src/main/java/org/elasticsearch/action/admin/indices/rollover/TransportRolloverAction.java#L174-L175). The counter, however, is an integer so it can be incremented up to Integer.MAX_VALUE (2^31-1 = 2147483647). So once you arrive at 999999, the next number will be 1000000 and so on. – Val Feb 17 '22 at 07:02

1 Answers1

0

I'm sorry but I think this can't be done.

The ILM pattern we have is: ilm_pattern => "{now/d}-00001"

This number is always increased by one, no matter what comes before.

Bibi
  • 33
  • 5