Cannot access Elasticsearch 2.0 in Vagrant VM from host OS Cannot access Elasticsearch 2.0 in Vagrant VM from host OS elasticsearch elasticsearch

Cannot access Elasticsearch 2.0 in Vagrant VM from host OS


In your /etc/elasticsearch/elasticsearch.yml configuration file set network.host: 0.0.0.0 so that elasticsearch is accessible outside of localhost. Remember to do a service elasticsearch restart.


Upon examining the ES log file (cat /var/log/elasticsearch/elasticsearch.log) I found that script.disable_dynamic: false was breaking things:

[2015-10-31 19:58:54,428][INFO ][node                     ] [Yuri Topolov] version[2.0.0], pid[9826], build[de54438/2015-10-22T08:09:48Z][2015-10-31 19:58:54,428][INFO ][node                     ] [Yuri Topolov] initializing ...[2015-10-31 19:58:54,537][INFO ][plugins                  ] [Yuri Topolov] loaded [], sites [][2015-10-31 19:58:54,630][INFO ][env                      ] [Yuri Topolov] using [1] data paths, mounts [[/ (/dev/mapper/precise64-root)]], net usable_space [72.3gb], net total_space [78.8gb], spins? [possibly], types [ext4][2015-10-31 19:58:58,668][ERROR][bootstrap                ] Guice Exception: java.lang.IllegalArgumentException: script.disable_dynamic is not a supported setting, replace with fine-grained script settings.Dynamic scripts can be enabled for all languages and all operations by replacing `script.disable_dynamic: false` with `script.inline: on` and `script.indexed: on` in elasticsearch.yml    at org.elasticsearch.script.ScriptService.<init>(ScriptService.java:146)    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)    at java.lang.reflect.Constructor.newInstance(Constructor.java:526)    at <<<guice>>>    at org.elasticsearch.node.Node.<init>(Node.java:198)    at org.elasticsearch.node.NodeBuilder.build(NodeBuilder.java:145)    at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:170)    at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:270)    at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:35)

I added that setting after I had my problem, but before I initially tried the suggestions in the comments, and so ES was failing. Fixing this setting didn't fix my original problem, but it was obscuring the solution.

Anyway, here is the bootstrap.sh file that is working for me:

#!/usr/bin/env bashsudo apt-get updatesudo apt-get upgrade# install curlsudo apt-get -y install curl# install openjdk-7 sudo apt-get purge openjdk*sudo apt-get -y install openjdk-7-jdk# install ESwget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -echo "deb http://packages.elastic.co/elasticsearch/2.x/debian stable main" | sudo tee -a /etc/apt/sources.list.d/elasticsearch-2.x.listsudo apt-get update && sudo apt-get install elasticsearchsudo update-rc.d elasticsearch defaults 95 10# either of the next two lines is needed to be able to access "localhost:9200" from the host ossudo echo "network.bind_host: 0" >> /etc/elasticsearch/elasticsearch.ymlsudo echo "network.host: 0.0.0.0" >> /etc/elasticsearch/elasticsearch.yml# enable cors (to be able to use Sense)sudo echo "http.cors.enabled: true" >> /etc/elasticsearch/elasticsearch.ymlsudo echo "http.cors.allow-origin: /https?:\/\/localhost(:[0-9]+)?/" >> /etc/elasticsearch/elasticsearch.yml# enable dynamic scriptingsudo echo "script.inline: on" >> /etc/elasticsearch/elasticsearch.ymlsudo echo "script.indexed: on" >> /etc/elasticsearch/elasticsearch.ymlsudo /etc/init.d/elasticsearch start