elasticsearch network.host
settings in elasticsearch.yml is to set bind address for incoming http traffic and node to node communication.
From the look of your bit of code it seems you are misinterpreting it with ip address of the clients for ip filtering.
Here in elasticsearch.yml configuration you can do the following -
1) change http traffic port (default is 9200) for incoming http traffic using http.port: 9200
.
2) change tcp port for transport clients for node to node communication using transport.tcp.port: 9300
.
3) you can change elasticsearch bind address for elasticsearch server where to listen for traffic using network.bind_host: 192.168.0.1
. You can change this to 'network.bind_host: localhost' to restrict public access.
More more detailed info on configuration please refer this and official documentation.
Now to achieve what you are trying i suggest you to use shield plugin which now comes free with X-Pack.
Shield offers IP filtering support where you can define IP address who can access your elasticsearch.
Shield plugin will allow you to block, allow ip addresses for accessing your elasticsearch server by extending the same elasticsearch.yml file. After successfully installing shield plugin you will be able to use shield
module in elasticsearch.yml file.
shield.transport.filter.enabled: false
shield.http.filter.enabled: true
shield.transport.filter.allow: [ "192.168.0.1", "192.168.0.2", "192.168.0.3", "192.168.0.4" ]
shield.transport.filter.deny: _all
Now these settings in elasticsearch.yml will be hard settings and after every change you may have to restart your server. Since you mentioned selected devices and computers and if the IP address for those devices changes dynamically. Then elastic also expose setting/configuring/changing IP address for IP filtering over their REST api as follows where you can change IP addresses on the fly without any restart
curl -XPUT localhost:9200/_cluster/settings -d '{
"persistent" : {
"shield.transport.filter.allow" : "172.16.0.0/24"
}
}'
curl -XPUT localhost:9200/_cluster/settings -d '{
"persistent" : {
"shield.transport.filter.enabled" : false
}
}'
This nice REST api for dynamically changing IP address for elastic along with other features of shield like authentication, authorization, document level roles can help you build a really fancy console interface/application for managing your elasticsearch cluster.
Please also refer the elasticsearch shield ip filtering documentation for more configuration info.
Hope this helps.