# The elasticsearch docker image is wiping my index when I stop and start the docker container

**URL:** <https://discuss.elastic.co/t/the-elasticsearch-docker-image-is-wiping-my-index-when-i-stop-and-start-the-docker-container/21937>\
**Category:** Elasticsearch\
**Created:** [January 31, 2015, 3:34pm UTC](https://discuss.elastic.co/t/the-elasticsearch-docker-image-is-wiping-my-index-when-i-stop-and-start-the-docker-container/21937 "2015-01-31T15:34:51Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Olav\_Gronas\_Gjerde](https://avatars.discourse-cdn.com/v4/letter/o/e19b73/32.png) [@Olav\_Gronas\_Gjerde](https://discuss.elastic.co/u/Olav_Gronas_Gjerde)\
**Post date:** [January 31, 2015, 3:34pm UTC](https://discuss.elastic.co/t/the-elasticsearch-docker-image-is-wiping-my-index-when-i-stop-and-start-the-docker-container/21937/1 "2015-01-31T15:34:51Z")

</div>

This is supposed to be a single instance, not a cluster. I've installed the  
icu-analyzer and head plugin.  
I run the container like this:

sudo docker run -it -p 9200:9200 -p 9300:9300 -v /esdata:/data --name  
my\_elasticsearch olavgg/elasticsearch /elasticsearch/bin/elasticsearch  
-Des.config=/elasticsearch/config/elasticsearch.yml

The elasticsearch.yml looks like this

path:  
data: /data/data  
logs: /data/log  
plugins: /data/plugins  
work: /data/work

cluster:  
name: olav

node:  
name: thenode

http.cors.allow-origin: "/.\*/"  
http.cors.enabled: true

Then I create a new index with following settings:

settingsBuilder.put("number\_of\_shards", 20);  
settingsBuilder.put("number\_of\_replicas", 0);  
settingsBuilder.put("refresh\_interval", "1s");  
settingsBuilder.put("store.type", "niofs");  
settingsBuilder.put("store.compress.stored", true);  
settingsBuilder.put("store.compress.tv", true);  
settingsBuilder.put("gateway.type", "none");  
settingsBuilder.put(  
"analysis.analyzer.norwegianAnalyzer.type",  
"custom");  
settingsBuilder.put(  
"analysis.analyzer.norwegianAnalyzer.tokenizer",  
"keyword");  
settingsBuilder.put(  
"analysis.analyzer.norwegianAnalyzer.filter",  
"norwegian");  
settingsBuilder.put(  
"analysis.filter.norwegian.type",  
"icu\_collation");  
settingsBuilder.put(  
"analysis.filter.norwegian.language",  
"nb");

Then I fill the index with data and see that /esdata folder grows in size.

If I stop the elasticsearch container(sudo docker stop my\_elasticsearch),  
the size in the /esdata folder is still the same.

But when I start the container again (sudo docker start my\_elasticsearch)  
it wipes all the data in my index and the /esdata folder size decreases to  
almost 0

And I only find this in the log:  
[2015-01-31 15:07:17,655][INFO][discovery] [thenode]  
olav/NbcqLoztTV2GWsat8hLXeQ  
[2015-01-31 15:07:21,457][INFO][cluster.service] [thenode]  
new\_master  
[thenode][NbcqLoztTV2GWsat8hLXeQ][8a166697b5d5][inet[/172.17.0.22:9300]],  
reason: zen-disco-join (elected\_as\_master)  
[2015-01-31 15:07:21,510][INFO][http] [thenode]  
bound\_address {inet[/0:0:0:0:0:0:0:0:9200]}, publish\_address  
{inet[/172.17.0.22:9200]}  
[2015-01-31 15:07:21,511][INFO][node] [thenode]  
started  
[2015-01-31 15:07:22,611][INFO][discovery.zen] [thenode]  
updating discovery.zen.minimum\_master\_nodes from [-1] to [1]  
[2015-01-31 15:07:22,692][INFO][gateway] [thenode]  
recovered [1] indices into cluster\_state

I guess I've misconfigured something? Is the new\_master in the log causing  
this?

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/981dd976-8c82-4460-a9be-7da022c98ac2%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/981dd976-8c82-4460-a9be-7da022c98ac2%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [January 31, 2015, 11:10pm UTC](https://discuss.elastic.co/t/the-elasticsearch-docker-image-is-wiping-my-index-when-i-stop-and-start-the-docker-container/21937/2 "2015-01-31T23:10:13Z")

</div>

ES does not wipe anything on restart, I'd say it's something in your Docker  
config.

On 1 February 2015 at 02:34, Olav Grønås Gjerde [olavgg@gmail.com](mailto:olavgg@gmail.com) wrote:

> This is supposed to be a single instance, not a cluster. I've installed  
> the icu-analyzer and head plugin.  
> I run the container like this:
> 
> sudo docker run -it -p 9200:9200 -p 9300:9300 -v /esdata:/data --name  
> my\_elasticsearch olavgg/elasticsearch /elasticsearch/bin/elasticsearch  
> -Des.config=/elasticsearch/config/elasticsearch.yml
> 
> The elasticsearch.yml looks like this
> 
> path:  
> data: /data/data  
> logs: /data/log  
> plugins: /data/plugins  
> work: /data/work
> 
> cluster:  
> name: olav
> 
> node:  
> name: thenode
> 
> http.cors.allow-origin: "/.\*/"  
> http.cors.enabled: true
> 
> Then I create a new index with following settings:
> 
> settingsBuilder.put("number\_of\_shards", 20);  
> settingsBuilder.put("number\_of\_replicas", 0);  
> settingsBuilder.put("refresh\_interval", "1s");  
> settingsBuilder.put("store.type", "niofs");  
> settingsBuilder.put("store.compress.stored", true);  
> settingsBuilder.put("[store.compress.tv](http://store.compress.tv)", true);  
> settingsBuilder.put("gateway.type", "none");  
> settingsBuilder.put(  
> "analysis.analyzer.norwegianAnalyzer.type",  
> "custom");  
> settingsBuilder.put(  
> "analysis.analyzer.norwegianAnalyzer.tokenizer",  
> "keyword");  
> settingsBuilder.put(  
> "analysis.analyzer.norwegianAnalyzer.filter",  
> "norwegian");  
> settingsBuilder.put(  
> "analysis.filter.norwegian.type",  
> "icu\_collation");  
> settingsBuilder.put(  
> "analysis.filter.norwegian.language",  
> "nb");
> 
> Then I fill the index with data and see that /esdata folder grows in size.
> 
> If I stop the elasticsearch container(sudo docker stop my\_elasticsearch),  
> the size in the /esdata folder is still the same.
> 
> But when I start the container again (sudo docker start my\_elasticsearch)  
> it wipes all the data in my index and the /esdata folder size decreases to  
> almost 0
> 
> And I only find this in the log:  
> [2015-01-31 15:07:17,655][INFO][discovery] [thenode]  
> olav/NbcqLoztTV2GWsat8hLXeQ  
> [2015-01-31 15:07:21,457][INFO][cluster.service] [thenode]  
> new\_master  
> [thenode][NbcqLoztTV2GWsat8hLXeQ][8a166697b5d5][inet[/172.17.0.22:9300]],  
> reason: zen-disco-join (elected\_as\_master)  
> [2015-01-31 15:07:21,510][INFO][http] [thenode]  
> bound\_address {inet[/0:0:0:0:0:0:0:0:9200]}, publish\_address {inet[/  
> 172.17.0.22:9200]}  
> [2015-01-31 15:07:21,511][INFO][node] [thenode]  
> started  
> [2015-01-31 15:07:22,611][INFO][discovery.zen] [thenode]  
> updating discovery.zen.minimum\_master\_nodes from [-1] to [1]  
> [2015-01-31 15:07:22,692][INFO][gateway] [thenode]  
> recovered [1] indices into cluster\_state
> 
> I guess I've misconfigured something? Is the new\_master in the log  
> causing this?
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/981dd976-8c82-4460-a9be-7da022c98ac2%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/981dd976-8c82-4460-a9be-7da022c98ac2%40googlegroups.com)  
> [https://groups.google.com/d/msgid/elasticsearch/981dd976-8c82-4460-a9be-7da022c98ac2%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/981dd976-8c82-4460-a9be-7da022c98ac2%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAEYi1X-hvq\_5mdEp8WogTV7P5EAs%3DAQProfvhiCc0byXroAcvQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAEYi1X-hvq_5mdEp8WogTV7P5EAs%3DAQProfvhiCc0byXroAcvQ%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Olav\_Gronas\_Gjerde](https://avatars.discourse-cdn.com/v4/letter/o/e19b73/32.png) [@Olav\_Gronas\_Gjerde](https://discuss.elastic.co/u/Olav_Gronas_Gjerde)\
**Post date:** [February 1, 2015, 6:16am UTC](https://discuss.elastic.co/t/the-elasticsearch-docker-image-is-wiping-my-index-when-i-stop-and-start-the-docker-container/21937/3 "2015-02-01T06:16:16Z")

</div>

I found the problem

settingsBuilder.put("gateway.type", "none");

This should be set to local:

settingsBuilder.put("gateway.type", "local");

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/508f0b42-bfc2-4d58-a19f-0e7e3201f26f%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/508f0b42-bfc2-4d58-a19f-0e7e3201f26f%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Ali\_Kheyrollahi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ali_kheyrollahi/32/945_2.png) [@Ali\_Kheyrollahi](https://discuss.elastic.co/u/Ali_Kheyrollahi)\
**Post date:** [February 1, 2015, 8:48am UTC](https://discuss.elastic.co/t/the-elasticsearch-docker-image-is-wiping-my-index-when-i-stop-and-start-the-docker-container/21937/4 "2015-02-01T08:48:09Z")

</div>

Please mark as completed.

On Sunday, 1 February 2015 06:16:16 UTC, Olav Grønås Gjerde wrote:

> I found the problem
> 
> settingsBuilder.put("gateway.type", "none");
> 
> This should be set to local:
> 
> settingsBuilder.put("gateway.type", "local");

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/42c4a6fa-c016-419c-86a0-aafb27369932%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/42c4a6fa-c016-419c-86a0-aafb27369932%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 12:35am UTC](https://discuss.elastic.co/t/the-elasticsearch-docker-image-is-wiping-my-index-when-i-stop-and-start-the-docker-container/21937/5 "2017-07-06T00:35:28Z")

</div>


