I installed elastic search in my local machine, I want to configure it as the only one single node in the cluster(Standalone Server). it means whenever I create a new index, it
I wanted to do this without having to write/overwrite an elasticsearch.yml in my container. Here it is without a config file
Set an environment variable prior to starting elasticsearch:
discovery.type=single-node
https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html
All of these didn´t help me (and I sadly didn´t read the answer of bhdrkn). The thing that worked for me was to change elasticsearch´s cluster-name everytime I need to have a separate instance, where new nodes aren´t added automatically via multicast.
Just change cluster.name: {{ elasticsearch.clustername }} in elasticsearch.yml, e.g. via Ansible. This is particulary helpful, when building separate Stages like Dev, QA and Production (which is a standard usecase in enterprise-environments).
And if you´re using logstash to get your data into elasticsearch, don´t forget to put the same cluster-name into the output-section, like:
output {
elasticsearch {
cluster => "{{ elasticsearch.clustername }}"
}
}
Otherwise your "logstash-*"-index will not be build correctly...
In the config file, add:
network.host: 0.0.0.0
[in Network settings] discovery.type: single-node
[in Discovery and Cluster formation settings]