question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support AWS OpenSearch / Elasticsearch

See original GitHub issue

Is your feature request related to a problem? Please describe. As of a couple months ago, the Elasticsearch organization has made the official python elasticsearch plugin incompatible with Amazon supported OpenSearch. If you fire up Superset using the current helm chart and attempt to connect to a recently deployed AWS “Elasticsearch” - which is now an Apache 2.0 licensed OpenSearch - you will receive the ambiguous error from Superset

superset 2021-09-16 17:34:09,348:WARNING:superset.views.base:[SupersetError(message='(builtins.NoneType) None\n(Background on this error at: http://sqlalche.me/e/13/dbapi)', error_type=<SupersetErrorType.GENERIC_DB_ENGINE_ERROR: 'GENERIC_DB_ENGINE_ERROR'>, level=<ErrorLevel.ERROR: 'error'>, extra={'engine_name': 'ElasticSearch (SQL API)', 'issue_codes': [{'code': 1002, ' 
 message': 'Issue 1002 - The database returned an unexpected error.'}]})]                                                                                                                                                                                                                                                                                                              

If I run python directly on the Superset pod and connect to AWS “OpenSearch/Elasticsearch” cluster, i get the more detailed error from the elasticsearch python module directly:

elasticsearch.exceptions.UnsupportedProductError: The client noticed that the server is not a supported distribution of Elasticsearch

It would be nice if Superset could support OpenSearch natively.

Describe the solution you’d like

  • At the least, highlight in the docs that the elasticsearch plugin needs downgrading to be compatible with AWS Elasticsearch/OpenSearch clusters for the time being.
  • Find a way to support OpenSearch natively. Quite annoyingly, I think AWS only published a java library for OpenSearch. An official python library that could be used by Sqlalchemy is needed I believe.

Describe alternatives you’ve considered I am currently using the following boostrapScript which downgrades the elasticsearch python plugin to the last known compatible version (before Elasticsearch became hostile to AWS, rightfully or not).

bootstrapScript: |
  #!/bin/bash
  rm -rf /var/lib/apt/lists/* && \
  pip uninstall elasticsearch && \
  pip install \
    elasticsearch==7.13.4 \
    elasticsearch-dbapi==0.2.5 \
    elasticsearch-dbapi[opendistro] \
    psycopg2==2.8.5 \
    redis==3.2.1 && 
  if [ ! -f ~/bootstrap ]; then echo "Running Superset with uid {{ .Values.runAsUser }}" > ~/bootstrap; fi

Additional context Ultimately, the fix may need to be made in SQLALCHEMY since that is the middle man between Superset and the databases, but I thought it was worth requesting here in case anyone else is trying to connect to an Amazon “Elasticsearch”/Opensearch cluster and was having difficulty.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:4
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

4reactions
dpgasparcommented, Sep 23, 2021

Hi @stockholmux, I’m a maintainer/creator of elasticsearch-dbapi. I’ll look into including opensearch-py on elasticsearch-dbapi

Thank you!

3reactions
stockholmuxcommented, Sep 23, 2021

👋 I’m on the OpenSearch team.

Here is some background on the client issue that appears to be causing this. I’m only vaguely familiar with SuperSet but I believe the issue originates here:

https://github.com/preset-io/elasticsearch-dbapi/blob/master/setup.py#L31

Effectively, Elasticsearch clients past will only work with non-OSS Elasticsearch moving forward (this break also affects Elasticsearch versions prior to 7.12 IIRC). The break occurred at ES Client v7.14, so the way by including elasticsearch>7 new installs are pulling the latest which includes the blocking code.

Opensearch clients (python client here) will work with both OpenSearch and ES and are syntax compatible. Not sure how SuperSet as a project wants to handle this, but I’m glad to help personally and get some other folks from our side to contribute.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Announcing Amazon OpenSearch Service which Supports ...
Amazon OpenSearch Service offers a seamless in-place upgrade path from existing Elasticsearch 6.x and 7.x managed clusters to OpenSearch.
Read more >
Amazon OpenSearch Service FAQs
Amazon OpenSearch Service offers the latest versions of OpenSearch, support for 19 versions of Elasticsearch (1.5 to 7.10 versions), as well as visualization ......
Read more >
Amazon OpenSearch Service
Amazon OpenSearch Service makes it easy for you to perform interactive log analytics, real-time application monitoring, website search, and more.
Read more >
What is Amazon OpenSearch Service? - AWS Documentation
Amazon OpenSearch Service is a managed service that makes it easy to deploy, operate, and scale OpenSearch clusters in the AWS Cloud.
Read more >
Supported operations in Amazon OpenSearch Service
OpenSearch Service supports many versions of OpenSearch and legacy Elasticsearch OSS. The following sections show the operations that OpenSearch Service ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found