What is network.host

Hello Everyone
i am new to elastic search
while configuring i found one parameter network.host in elasticsearch.yml file
while exploring abt this some one said use 0.0.0.0 to make ur elastic search accessible to public
and doccument has this
sets the address of this node for both HTTP and transport traffic. The node will bind to this address and will also use it as its publish address. Accepts an IP address, a hostname, or a special value .
i am unable to understand this can some one help me what is the use of network.host

You need to set it if you want your node to be accessible from another machine.

Thanks for the answer
Can u clarify my doubt here
I installed elasticsearch in aws ec2 instance
I want to access the elasticsearch from my browser so in security group I added new rule called allow only from my ip.
should I add my computer ip at network.host to access the elastic search from my computer browser, is this u r saying. Is this only purpose or do we have any?

Thanks,
Surya.

The network.host config is used to tell elasticsearch which IP in the server it will use to bind.

Every service running in a server needs to bind to at least one IP, since servers can have multiple IPs, you can use 0.0.0.0 to tell the service to bind to all the IPs available on the server.

Your EC2 instance will normally have 2 IP address, the loopback IP, 127.0.0.1 and the VPC IP, that will depend on your configuration.

If you set network.host to 127.0.0.1 you would only be able to access elasticsearch from the same server it is running, so since you want to access from outside the server you can't use this IP.

You can configure network.host to use the other IP in your ec2 instance, if the IP is for example 172.16.10.50 and you set network.host: 172.16.10.50, the elasticsearch will be acessible from outside the server to every other machine that can reach this IP.

To make things easier, use 0.0.0.0 and your service will listen on every IP in your server.

So, If you want to access your elasticsearch from outside the server where it is running, configure network.host to use 0.0.0.0, it will start and will listen in every ip available in the EC2 instance.

1 Like

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