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

Automatic snapshot naming #7939

Closed
grantr opened this issue Sep 30, 2014 · 3 comments
Closed

Automatic snapshot naming #7939

grantr opened this issue Sep 30, 2014 · 3 comments
Labels
:Distributed/Snapshot/Restore Anything directly related to the `_snapshot/*` APIs >enhancement good first issue low hanging fruit help wanted adoptme v6.4.0 v7.0.0-beta1

Comments

@grantr
Copy link

grantr commented Sep 30, 2014

It would be useful if Elasticsearch could generate automatic snapshot names. This would be a POST to the repository instead of a PUT to a snapshot name.

curl -XPOST localhost:9200/_snapshot/my-repository

The name could be generated by incrementing a number (1, 2, 3, etc), getting the current timestamp, or generating a flake id.

To organize snapshots in a repository, the POST action could accept a prefix parameter.

curl -XPOST localhost:9200/_snapshot/my-repository?prefix=my-index -d '{"indices":"my-index"}'
@s1monw s1monw added the discuss label Oct 1, 2014
@colings86
Copy link
Contributor

I would be wary of just having an incrementing number as it doesn't containing any information about the point in time the snapshot relates to, but maybe we could use something like the combination of timestamp and flake ID so that the timestamp indicates the point in time the snapshot was created and the flake ID makes the name unique?

@grantr
Copy link
Author

grantr commented Feb 21, 2015

@colings86 the snapshot metadata already includes the timestamp, so it's not necessary for preserving snapshot creation time. Still, I support using the timestamp as id because timestamps are useful when looking at a list of snapshot names. Most of our snapshots are named with the pattern prefix-2015-02-21_12-57-41 for natural ordering and so that it's easy to see when snapshots occurred.

@tlrx
Copy link
Member

tlrx commented Mar 21, 2018

We looked at this today with @ywelsch and we came up with the idea of reusing the date math expression resolver that already exists for indices.

This way we could create a snapshot like

POST /_snapshot/my-repository/<snapshot-{now/d}>

and it would be resolved to snapshot-2018.03.21.

vladimirdolzhenko pushed a commit to vladimirdolzhenko/elasticsearch that referenced this issue May 9, 2018
@vladimirdolzhenko vladimirdolzhenko self-assigned this May 9, 2018
vladimirdolzhenko pushed a commit to vladimirdolzhenko/elasticsearch that referenced this issue May 11, 2018
move test case to DedicatedClusterSnapshotRestoreIT
vladimirdolzhenko pushed a commit to vladimirdolzhenko/elasticsearch that referenced this issue May 11, 2018
extended doc: example is added. referring to indices date math more clearly
vladimirdolzhenko pushed a commit to vladimirdolzhenko/elasticsearch that referenced this issue May 15, 2018
vladimirdolzhenko pushed a commit to vladimirdolzhenko/elasticsearch that referenced this issue May 15, 2018
vladimirdolzhenko pushed a commit to vladimirdolzhenko/elasticsearch that referenced this issue May 15, 2018
vladimirdolzhenko pushed a commit to vladimirdolzhenko/elasticsearch that referenced this issue May 15, 2018
vladimirdolzhenko added a commit that referenced this issue May 16, 2018
Allow date math for naming newly-created snapshots (#7939)
vladimirdolzhenko pushed a commit that referenced this issue May 16, 2018
jasontedor added a commit to jasontedor/elasticsearch that referenced this issue May 16, 2018
…bad-mkay

* elastic/6.x:
  [ML] Wait for ML indices in rolling upgrade tests (elastic#30615)
  Watcher: Ensure secrets integration tests also run triggered watch (elastic#30478)
  Move allocation awareness attributes to list setting (elastic#30626)
  [Docs] Update code snippet in has-child-query.asciidoc (elastic#30510)
  Allow date math for naming newly-created snapshots (elastic#7939) (elastic#30479)
  Awaits fix a failing test
  Switch many QA projects to use new style requests (elastic#30574)
  QA: System property to override distribution (elastic#30591)
@jimczi jimczi removed the v7.0.0 label Feb 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Distributed/Snapshot/Restore Anything directly related to the `_snapshot/*` APIs >enhancement good first issue low hanging fruit help wanted adoptme v6.4.0 v7.0.0-beta1
Projects
None yet
Development

No branches or pull requests

9 participants