TH Docs

How to Set Up Elasticsearch Head on Mac

2019-12-03

For the three TitanHouse environments: development, staging, and production.

prelimary

  1. Get Elasticsearch Head Chrome extension.
  2. In Chrome open ES Head page. Can bookmark for easy access. chrome-extension://ffmkiejjmecolpfloofpjologoblkegm/elasticsearch-head/index.html

development (dev), staging (qa), and production (prod)

  1. Obtain ssh-jump-box.pem key file and move it to your home ssh folder ~/.ssh/ or other convenient place.
  2. In Terminal run sudo nano /etc/hosts or use favorite text editor with admin privilege. At bottom or anywhere you like, add these two lines: 127.0.0.1 th_elastic_dev-qa.us-east-1.es.amazonaws.com 127.0.0.1 th_elastic_prod.us-east-1.es.amazonaws.com
  3. In Terminal run nano ~/.ssh/config or use favorite text editor. Add (and change ~/.ssh/ key file if needed): Host estunnel_dev_qa HostName jumpbox.titanhouseapp.net User ec2-user IdentityFile ~/.ssh/ssh-jump-box.pem LocalForward 9201 vpc-dev-qa-elasticsearch-56-5woww2b5uknp7pvi6gqwuiohbu.us-east-1.es.amazonaws.com:443 Host estunnel_prod HostName jumpbox.titanhouseapp.net User ec2-user IdentityFile ~/.ssh/ssh-jump-box.pem LocalForward 9202 vpc-elastic-uat-o5sx4clul237c6at4r7k7g7o2m.us-east-1.es.amazonaws.com:443
  4. In Terminal run one of: ssh -N estunnel_dev_qa (or) ssh -N estunnel_prod
  5. Super-sophisticated: edit ~/.bash_profile and add something like: alias estunnel_dev_qa='ssh -N estunnel_dev_qa' alias estunnel_prod='ssh -N estunnel_prod'

    Then in Terminal run one or both: estunnel_dev_qa (or) estunnel_prod

  6. In Chrome on ES Head page enter respective connection URL.

    Make sure to use the right URL and port number for the intended environment.

    staging (QA): https://th_elastic_dev-qa.us-east-1.es.amazonaws.com:9201/
    ES Head should display dev-qa-elasticsearch-56.

    production: https://th_elastic_prod.us-east-1.es.amazonaws.com:9202/
    ES Head should display elastic-uat.

  7. Go hog-wild in Elasticsearchland.
  8. When finished, in Terminal, enter Control-C to close tunnels.

Local Project Config — when working against remote DEV indices

If you are working on a branch of the api, and require usage of the dev/qa elastic search. Then the following namespace needs to be included in the configuration for the driver to use the correct indices.

Under titanhouse-api project packages/cp-api/src/config/local.example.js and packages/search-api/src/config/local.example.js there is an example elastic {} config block, which should be taken and modified for CP-API and SEARCH-API.

elastic: { apiVersion: '5.5', keepAlive: true, host: 'https://th_elastic_dev-qa.us-east-1.es.amazonaws.com:9201', namespace: 'dev' },

The End