Skip to content

Troubleshooting Opensearch and Quepid

Eric Pugh edited this page Sep 15, 2023 · 4 revisions

Connecting Opensearch to Quepid

The traditional way to connect Quepid to Opensearch is to configure Opensearch to accept requests from the browser and is documented below.

Opensearch Accepting Browser Requests

You will need to configure Opensearch to accept requests from the browser using CORS. To enable CORS, the following config is available in the opensearch-compose.yml file in the environment section. It can be configured as desired.

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

Opensearch 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
      - http.cors.allow-credentials=true
      - "http.cors.allow-origin=/https?:\/\/localhost(:9200)?/"
      - "http.cors.allow-headers=X-Requested-With, Content-Type, Content-Length,if-modified-since,Authorization"

The last two lines allow for the authentication to happen via headers, which is the way Opensearch likes it. Notice the allow-origin is set up to only allow access from localhost port 9200. If you don't care, just use "*".

Setup SSH Port Forwarding to a Locked Down Cluster

Encountered a locked down Opensearch cluster? For example, using AWS Opensearch that has a private subnet?
One option is to use a local ssh port forward into the cluster that forwards requests to your local http://localhost:9200/<index>/_search, and use that URL in Quepid.

ssh -i ~/.ssh/<gateway-machine-security-file>.pem -L9200:<es-cluster-ip>:443 ec2-user@<gateway-machine>

The -L parameter is critical, the -i is machine-dependent.

Demo Opensearch Indexes with the TMDB dataset

We now have a setup of Opensearch deployed with the TMDB dataset using some basic aut.