awselasticsearch

Install elasticsearch-head

Elasticsearch-head is a Web front-end for an Elasticsearch cluster. For Elasticsearch 5.x, site plugins are not supported, so it needs to run as a standalone server. Follow these steps:

  • Install Node.js and npm from the official website.

  • Download the elasticsearch-head ZIP file and decompress it:

      $ wget https://github.com/mobz/elasticsearch-head/archive/master.zip
      $ unzip master.zip
    
  • Install the modules and run the service:

      $ cd elasticsearch-head-master
      $ npm install
      $ ./node_modules/grunt/bin/grunt server &
    
  • Update the /opt/bitnami/elasticsearch/config/elasticsearch.yml file and enable CORS by setting http.cors.enabled to true:

      http.cors.enabled: true
    
  • In the same file, set the http.cors.allow-origin variable to the domains that are allowed to send cross-origin requests. If you prepend and append a “/” to the value, this will be treated as a regular expression. For example:

      http.cors.allow-origin: /https?:\/\/localhost(:[0-9]+)?/
    

NOTE: You can set the value of http.cors.allow-origin to “*” to allow CORS requests from anywhere if you wish. However, this is not recommended as it is a security risk.

  • Add Apache configuration for elasticsearch-head to /opt/bitnami/elasticsearch/apache-conf/elasticsearch.conf:

      ProxyPass        /elasticsearch-head http://127.0.0.1:9100
      ProxyPassReverse /elasticsearch-head http://127.0.0.1:9100
    
  • Restart the services:

      $ sudo /opt/bitnami/ctlscript.sh restart apache
    
  • Browse to http://SERVER-IP/elasticsearch-head/?base_uri=http://SERVER-IP/elasticsearch and insert your Elasticsearch credentials. You should see something like the screenshot below:

elasticsearch-head interface

Last modification December 21, 2022