How do I enable remote access/request in Elasticsearch 2.0?

前端 未结 12 773
醉酒成梦
醉酒成梦 2020-12-22 22:09

Starting from v2.0 Elasticsearch is listening only on localhost by default, but I\'d like to make request outside localhost.

For example, a request like this is allo

12条回答
  •  不思量自难忘°
    2020-12-22 22:54

    Rename the elasticsearch.yml file to elasticsearch.json inside config folder and add:

    {
        "network" : {
            "host" : "10.0.0.4"
        }
    }
    

    Another option is to provide the settings externally either using the ES_JAVA_OPTS or as parameters to the elasticsearch command, for example:

    $ elasticsearch -Des.network.host=10.0.0.4

    Another option is to set es.default. prefix instead of es. prefix, which means the default setting will be used only if not explicitly set in the configuration file.

    Another option is to use the ${...} notation within the configuration file which will resolve to an environment setting, for example:

    {
        "network" : {
            "host" : "${ES_NET_HOST}"
        }
    }
    

    The location of the configuration file can be set externally using a system property:

    $ elasticsearch -Des.config=/path/to/config/file

    For more info, check out https://www.elastic.co/guide/en/elasticsearch/reference/1.4/setup-configuration.html

提交回复
热议问题