# Settings template in Docker file

**URL:** <https://discuss.elastic.co/t/settings-template-in-docker-file/169643>\
**Category:** Elasticsearch\
**Tags:** docker\
**Created:** [February 23, 2019, 4:43am UTC](https://discuss.elastic.co/t/settings-template-in-docker-file/169643 "2019-02-23T04:43:40Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hemant\_Kumar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hemant_kumar/32/41960_2.png) [@Hemant\_Kumar](https://discuss.elastic.co/u/Hemant_Kumar)\
**Post date:** [February 23, 2019, 4:43am UTC](https://discuss.elastic.co/t/settings-template-in-docker-file/169643/1 "2019-02-23T04:43:40Z")

</div>

Hi, I am running elasticsearch cluster on kubernetes cluster. I want to set max\_result\_window inside the dockerfile through settings template. How would I do that? I didn't find any valuable resource online. Please help!

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [February 23, 2019, 5:00am UTC](https://discuss.elastic.co/t/settings-template-in-docker-file/169643/2 "2019-02-23T05:00:28Z")

</div>

This is an index setting ([https://www.elastic.co/guide/en/elasticsearch/reference/current/index-modules.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/index-modules.html)).  
You can't define it in a file.  
You need to call the index settings API or use index template API.

---

<div class="post-metadata">

**Author:** ![Hemant\_Kumar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hemant_kumar/32/41960_2.png) [@Hemant\_Kumar](https://discuss.elastic.co/u/Hemant_Kumar)\
**Post date:** [February 23, 2019, 5:12am UTC](https://discuss.elastic.co/t/settings-template-in-docker-file/169643/3 "2019-02-23T05:12:22Z")

</div>

but if I restart my es cluster, settings will get lost, if I set it through es API. curl -XPUT "localhost:9200/\_all/\_settings" -H "Content-Type: application/json" -d '{"index":{“max\_result\_window":1000000}}'  
How to set it permanent?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [February 23, 2019, 8:04am UTC](https://discuss.elastic.co/t/settings-template-in-docker-file/169643/4 "2019-02-23T08:04:52Z")

</div>

First that's a bad idea to set it to such a big number.  
Then yes it is persistent.

But may be you don't persist your data volume in Docker?

---

<div class="post-metadata">

**Author:** ![Hemant\_Kumar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hemant_kumar/32/41960_2.png) [@Hemant\_Kumar](https://discuss.elastic.co/u/Hemant_Kumar)\
**Post date:** [February 25, 2019, 6:06am UTC](https://discuss.elastic.co/t/settings-template-in-docker-file/169643/5 "2019-02-25T06:06:41Z")

</div>

I am not persisting data in elasticsearch cluster. If I will persist data than settings will get retain even if we restart the cluster. Is there any other option to define settings in Dockerfile while building cluster rather than explicitly define using calling elastic API?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [February 25, 2019, 6:49am UTC](https://discuss.elastic.co/t/settings-template-in-docker-file/169643/6 "2019-02-25T06:49:41Z")

</div>

If you don't have a cluster of multiple nodes, if you don't have a persistent data volume, then the cluster state which contains all the settings will not survive when you switch off the node.

But do you want not to save your data? Is that for testing or something like that? What is your use case?

> Is there any other option to define settings in Dockerfile while building cluster rather than explicitly define using calling elastic API?

You can create a shell script which waits for elasticsearch to be available and then call the create index or create template API.

---

<div class="post-metadata">

**Author:** ![Hemant\_Kumar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hemant_kumar/32/41960_2.png) [@Hemant\_Kumar](https://discuss.elastic.co/u/Hemant_Kumar)\
**Post date:** [March 14, 2019, 10:58am UTC](https://discuss.elastic.co/t/settings-template-in-docker-file/169643/7 "2019-03-14T10:58:18Z")

</div>

Sorry, for the late reply. Actually, storing data will use unnecessary space in AWS s3. Second one make more sense to me. I will try with shell script to call index setting template API

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [March 14, 2019, 11:58am UTC](https://discuss.elastic.co/t/settings-template-in-docker-file/169643/8 "2019-03-14T11:58:43Z")

</div>

What is the relationship with S3 here?

---

<div class="post-metadata">

**Author:** ![Hemant\_Kumar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hemant_kumar/32/41960_2.png) [@Hemant\_Kumar](https://discuss.elastic.co/u/Hemant_Kumar)\
**Post date:** [March 14, 2019, 12:28pm UTC](https://discuss.elastic.co/t/settings-template-in-docker-file/169643/9 "2019-03-14T12:28:41Z")

</div>

When I launch an es cluster I have to define Retain/Delete mode of PV in kubernetes. If I will define PV in Retain mode, than I need to manage EBS volume unnecessarily and it will cost us too.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [March 14, 2019, 1:34pm UTC](https://discuss.elastic.co/t/settings-template-in-docker-file/169643/10 "2019-03-14T13:34:00Z")

</div>

EBS is not S3. That's why I asked.

---

<div class="post-metadata">

**Author:** ![Hemant\_Kumar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hemant_kumar/32/41960_2.png) [@Hemant\_Kumar](https://discuss.elastic.co/u/Hemant_Kumar)\
**Post date:** [March 14, 2019, 2:03pm UTC](https://discuss.elastic.co/t/settings-template-in-docker-file/169643/11 "2019-03-14T14:03:33Z")

</div>

Ahh, sorry I got distracted. You are right.

---

<div class="post-metadata">

**Author:** ![Hemant\_Kumar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hemant_kumar/32/41960_2.png) [@Hemant\_Kumar](https://discuss.elastic.co/u/Hemant_Kumar)\
**Post date:** [March 14, 2019, 2:51pm UTC](https://discuss.elastic.co/t/settings-template-in-docker-file/169643/12 "2019-03-14T14:51:29Z")

</div>

So, basically I am using a Helm template for creating elastic cluster. So, I think I need to add a script after es is ready and apply the settings

---

<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:** [April 11, 2019, 2:51pm UTC](https://discuss.elastic.co/t/settings-template-in-docker-file/169643/13 "2019-04-11T14:51:34Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
