Settings template in Docker file

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!

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.

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?

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?

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?

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.

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

What is the relationship with S3 here?

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.

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

Ahh, sorry I got distracted. You are right.

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

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