How to config Single node for Single Cluster (Standalone Cluster) ElasticSearch

In elasticsearch.yml

# Note, that for development on a local machine, with small indices, it usually
# makes sense to "disable" the distributed features:
#
index.number_of_shards: 1
index.number_of_replicas: 0

Use the same configuration in your code.

Also to isolate the node use node.local: true or discovery.zen.ping.multicast: false


I ve got the answer from http://elasticsearch-users.115913.n3.nabble.com/How-to-isolate-elastic-search-node-from-other-nodes-td3977389.html.

Kimchy : You set the node to local(true), this means it will not discover other nodes using network, only within the same JVM.

in elasticsearch/bin/elasticsearch.yml file

node.local: true # disable network

Updated for ES 7.x

in elasticsearch.yml

network.host: 0.0.0.0
discovery.type: single-node

and make sure you have cluster.initial_master_nodes off

# cluster.initial_master_nodes: ["node-1", "node-2"]

credited to @Chandan.