Skip to content
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

Store index creation time in index metadata #7218

Merged
merged 1 commit into from Aug 12, 2014
Merged

Store index creation time in index metadata #7218

merged 1 commit into from Aug 12, 2014

Conversation

colings86
Copy link
Contributor

This change stores the index creation time in the index metadata when an index is created. The creation time cannot be changed but can be set as part of the create index request to allow for correct creation times for historical data.

Closes #7119

@dadoonet
Copy link
Member

Although my comment is not directly related to the PR, I think that if we can also support last_update metadata, it would give us some new features to detect cold indices for examples and create some rules in the future such as:

  • Automatically close indices which has not been updated for 2 months
  • Automatically optimize cold indices (no update in the last 3 days)

Related to #3933

@colings86 colings86 self-assigned this Aug 12, 2014
@@ -363,6 +363,8 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws

builder.field("state", indexMetaData.state().toString().toLowerCase(Locale.ENGLISH));

builder.field("creation_date", indexMetaData.creationDate());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it should rather be part of the index meta data settings? (like the created version and the uuid?)

@jpountz jpountz removed the review label Aug 12, 2014
@jpountz
Copy link
Contributor

jpountz commented Aug 12, 2014

Left one comment but other than that it looks good to me.

@@ -556,6 +574,7 @@ public static void toXContent(IndexMetaData indexMetaData, XContentBuilder build
builder.startObject(indexMetaData.index(), XContentBuilder.FieldCaseConversion.NONE);

builder.field("version", indexMetaData.version());
builder.field("creation_date", indexMetaData.creationDate());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it is needed, it will be serialized as part of the settings?

This change stores the index creation time in the index metadata when an index is created.  The creation time cannot be changed but can be set as part of the create index request to allow for correct creation times for historical data.

Closes #7119
@colings86 colings86 merged commit 2906d3e into elastic:master Aug 12, 2014
@colings86 colings86 deleted the fix/7119 branch August 13, 2014 08:10
@jpountz jpountz removed the review label Aug 18, 2014
@colings86 colings86 assigned colings86 and unassigned colings86 Aug 21, 2014
@clintongormley clintongormley changed the title Core: Store index creation time in index metadata Internal: Store index creation time in index metadata Sep 10, 2014
@clintongormley clintongormley added the :Core/Infra/Settings Settings infrastructure and APIs label Jun 7, 2015
@clintongormley clintongormley changed the title Internal: Store index creation time in index metadata Store index creation time in index metadata Jun 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Core: Formalize index creation time as part of index metadata
4 participants