Skip to content

Troubleshooting Elasticsearch and Quepid

Eric Pugh edited this page Aug 8, 2019 · 16 revisions

Connecting Elasticsearch to Quepid

You will need to configure Elasticsearch to accept requests from the browser using CORS. To enable CORS, add the following to elasticsearch's config file. Usually, this file is located near the elasticsearch executable at config/elasticsearch.yml.

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

Elasticsearch w/ Basic auth

If you are using Basic Authentication, ie a URL in the format of [http|https]://[username:password@][host][:port]/[collectionName]/_search then you will need to add:

http.cors:
  enabled: true
  allow-origin: /https?:\/\/localhost(:3000)?/
  allow-credentials: true
  allow-headers: "X-Requested-With, Content-Type, Content-Length, Authorization"

The last two lines allow for the authentication to happen via headers, which is the way Elasticsearch likes it. Notice the allow-origin is set up to only allow access from port 3000.

Demo Elasticsearch Indexes with the TMDB dataset

We now have three different versions of Elasticsearch deployed with the same TMDB dataset, which is useful if you have a new feature that you want to make sure is backwards compatible.