Settings template in Docker file

docker

(Hemant Kumar) #1

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!


(David Pilato) #2

This is an index setting (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.


(Hemant Kumar) #3

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?


(David Pilato) #4

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?


(Hemant Kumar) #5

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?


(David Pilato) #6

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.


(Hemant Kumar) #7

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


(David Pilato) #8

What is the relationship with S3 here?


(Hemant Kumar) #9

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.


(David Pilato) #10

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


(Hemant Kumar) #11

Ahh, sorry I got distracted. You are right.


(Hemant Kumar) #12

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