elastic / elasticsearch-cloud-aws

AWS Cloud Plugin for Elasticsearch
https://github.com/elastic/elasticsearch/tree/master/plugins/discovery-ec2
577 stars 181 forks source link

Listing snapshot for a given repository returns all the snapshots in the bucket #248

Closed gursohippo closed 8 years ago

gursohippo commented 8 years ago

Hi guys, not sure this is a real bug, but here it goes:

I registered 3 different S3 repositories using a single S3 bucket and the same credentials for 3 indices from the same instance of elasticsearch. Each repository is named after the index that is supposed to snapshot every day (to make automation easier). So ATM I have one bucket, 3 repos and 3 indices. Snapshots creation/deletion and restore work just fine. What is not working is that when I try to get a list of the snapshots present in a given repository like this :curl -XGET localhost:9200/_snapshot/index-1/_all?pretty, the api returns all the snapshots present in the bucket (meaning also the ones from repositories other than the one called "index1").

Reproduce:

  1. start from an instance with at least two indices (index-1 and index-2)
  2. for each index register a repository with one index only on S3 with same name as the index and in the same S3 bucket
  3. take a snapshot of each index
  4. check the snapshot of index-2 in the repository of index-1 as in: GET 'localhost:9200/_snapshot/index-1/snapshot-of-index-2/?pretty'

At this point you shouldn't get any result but you do get the info about the snapshot

Do you think I did something wrong in the implementation or it can be considered a bug? Is calling the repositories the same as the indices bad? I also tested the other way around: curl -XGET 'localhost:9200/_snapshot/index-1/2015-10-08_index-2/?pretty' this shouldn't return anything but it actually returns info about the snapshot /2015-10-08_index-2. This shouldn't happen because i specified a 'wrong' repository on purpose...

Is it because I used the same bucket for all repositories? Is it because I named the repos after the indices? Is it a bug?

Thank you very much. Giuseppe

xuzha commented 8 years ago

This is because of using the same bucket.

gursohippo commented 8 years ago

Thank you very much @xuzha

Giuseppe