jprante / elasticsearch-knapsack

Knapsack plugin is an import/export tool for Elasticsearch
Apache License 2.0
472 stars 77 forks source link

Cannot change the number of shards using knapsack #44

Open ThaleJacobs-TomTom opened 10 years ago

ThaleJacobs-TomTom commented 10 years ago

I am attempting to follow the instructions for changing the number of shards on an index. Here is a link to the tutorial:

https://github.com/jprante/elasticsearch-knapsack

curl -XDELETE localhost:9200/test curl -XPUT 'localhost:9200/test/test/1' -d '{"key":"value 1"}' curl -XPUT 'localhost:9200/test/test/2' -d '{"key":"value 2"}' curl -XPUT 'localhost:9200/test/foo/1' -d '{"key":"value 1"}' curl -XPUT 'localhost:9200/test/bar/1' -d '{"key":"value 1"}' curl -XPOST 'localhost:9200/test/_export?path=/home/thalej/ESData/test.tar.gz' tar zxvf test.tar.gz test/_settings echo '{"index.number_of_shards":"1","index.number_of_replicas":"0","index.version.created":"200199"}' > test/_settings curl -XDELETE 'localhost:9200/test' curl -XPOST 'localhost:9200/test/_import?test_settings=test/_settings&path=/home/thalej/ESData/test.tar.gz' curl -XGET 'localhost:9200/test/_settings?pretty' curl -XPOST 'localhost:9200/test/_search?q=*&pretty'

The only difference between the tutorial and what I posted is that I supply the path to the test.tar.gz file.

When I unzip the file using: "tar zxvf test.tar.gz test/_settings", it creates a file called: "test/_settings/null/null", with seems a bit odd, but ok I guess. But then when I run the next command: echo '{"index.number_of_shards":"1","index.number_of_replicas":"0","index.version.created":"200199"}' > test/_settings

It fails because a directory was made (test/_settings) from un-compressing the tar file so the echo command cannot echo to a directory.

So my question is this: Has anyone had success exporting to a file path, changing the number of shards and then importing the export file? If so, your posted example would be much appreciated. Thanks

AntonioCiolino commented 8 years ago

My only success was with creating a new index with the number of shards set then doing an import with &createIndex=false.