-
Notifications
You must be signed in to change notification settings - Fork 24.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ILM: parse origination date from index name #46755
ILM: parse origination date from index name #46755
Conversation
Pinging @elastic/es-core-features |
Thanks for opening this for discussion Andrei! I have some ideas for how to implement it.
I think to start we should support the One thing I notice from your PR is parsing
I agree that the
We should be extremely strict about parsing errors, so that we avoid any unintended behavior around the age of the index, especially since this can lead to data being deleted with an unintended retention period. We can do this by registering an |
Introduce the `index.lifecycle.parse_origination_date` setting that indicates if the origination date should be parsed from the index name. If set to true an index which doesn't match the expected format (namely `indexName-{dateFormat}-optional_digits` will fail before being created. The origination date will be parsed when initialising a lifecyle for an index and it will be set as the `index.lifecycle.origination_date` for that index. A user set value for `index.lifecycle.origination_date` will always override a possible parsable date from the index name.
@elasticmachine update branch |
Adding the initial draft PR description here for completeness (and to provide context to @dakrone 's comment) Initial draft for parsing the origination date from the index name. This is meant solely as support for discussion on how to implement A few assumptions that we should discuss:
|
@elasticmachine update branch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank Andrei, I think this will be a great feature to have! I left some comments and questions for you on this.
...core/src/main/java/org/elasticsearch/xpack/core/ilm/IndexLifecycleOriginationDateParser.java
Outdated
Show resolved
Hide resolved
.../plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/InitializePolicyContextStep.java
Show resolved
Hide resolved
...src/test/java/org/elasticsearch/xpack/core/ilm/IndexLifecycleOriginationDateParserTests.java
Show resolved
Hide resolved
x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/IndexLifecycleService.java
Outdated
Show resolved
Hide resolved
x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/IndexLifecycle.java
Show resolved
Hide resolved
...in/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/TransportExplainLifecycleAction.java
Outdated
Show resolved
Hide resolved
.../plugin/ilm/src/test/java/org/elasticsearch/xpack/ilm/IndexLifecycleInitialisationTests.java
Show resolved
Hide resolved
...core/src/main/java/org/elasticsearch/xpack/core/ilm/IndexLifecycleOriginationDateParser.java
Show resolved
Hide resolved
@elasticmachine update branch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for iterating on this Andrei! I played with it locally and it works very well.
* ILM: parse origination date from index name Introduce the `index.lifecycle.parse_origination_date` setting that indicates if the origination date should be parsed from the index name. If set to true an index which doesn't match the expected format (namely `indexName-{dateFormat}-optional_digits` will fail before being created. The origination date will be parsed when initialising a lifecycle for an index and it will be set as the `index.lifecycle.origination_date` for that index. A user set value for `index.lifecycle.origination_date` will always override a possible parsable date from the index name. (cherry picked from commit c363d27) Signed-off-by: Andrei Dan <[email protected]>
* ILM: parse origination date from index name (#46755) Introduce the `index.lifecycle.parse_origination_date` setting that indicates if the origination date should be parsed from the index name. If set to true an index which doesn't match the expected format (namely `indexName-{dateFormat}-optional_digits` will fail before being created. The origination date will be parsed when initialising a lifecycle for an index and it will be set as the `index.lifecycle.origination_date` for that index. A user set value for `index.lifecycle.origination_date` will always override a possible parsable date from the index name. (cherry picked from commit c363d27) Signed-off-by: Andrei Dan <[email protected]> * Drop usage of Map.of to be java 8 compliant
Introduce the
index.lifecycle.parse_origination_date
setting thatindicates if the origination date should be parsed from the index name.
If set to true an index which doesn't match the expected format (namely
indexName-{dateFormat}-optional_digits
will fail before being created.The origination date will be parsed when initialising a lifecycle for an
index and it will be set as the
index.lifecycle.origination_date
forthat index.
A user set value for
index.lifecycle.origination_date
will alwaysoverride a possible parsable date from the index name.
Together with #46561 closes #42449
gradle check
?