Multiple Nodes of Elastic Search

I am using elasticsearch using docker-compose. This is how my docker-compose looks like:

image: elasticsearch:2.4
command: elasticsearch
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
soft: -1
hard: -1
- /data/elasticsearch:/usr/share/elasticsearch/data

I create an index "my_index" using the above and add in my data. Now in /data/elasticsearch/nodes/ there are multiple nodes from 0/, 1/, 2/.

Now, if I create another instance of the elasticsearch container, it is not able to find "my_index"

Why so?

Are you creating another instance while the first one is running?

Yes. But the path for both the instance is same. /data/elasticsearch:/usr/share/elasticsearch/data

Each node is a separated instance and has its own data dir.
If you want to form a cluster, then change the configuration accordingly.

Elasticsearch will then duplicate the data for you wherever data dir is.

Can you point me to the relevant link for setting this up correctly?

Also, is it possible to have just one node?

This and the other related sections

One node only? Yes. This is what you did yet, no?

I don't explicitly set anything. However under nodes, there are multiple directories with id 0,1,2,3,..,12. Each containing a subdirectory called index with a particular index.

Now, when I start an instance of the container, I think it loads only one of these directories under nodes. I want each instance to have access to all the indices.

How can I achieve it?

Your instances need to form a cluster — you can check that with curl <ip>:<port>/_cat/nodes and the IP and port of an Elasticsearch instance. You will need to configure as described in the relevant docs.

PS: We don't support Elasticsearch 2.4 any more, so you should definitely upgrade. Also the Docker image you are using is not from us, but from Docker. You can get our images from

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