django-haystack icon indicating copy to clipboard operation
django-haystack copied to clipboard

Latest Elasticsearch client not working with OpenSearch

Open automartin5000 opened this issue 3 years ago • 4 comments

  • [✅ ] Tested with the latest Haystack release
  • [ ] Tested with the current Haystack master branch

Expected behaviour

Elasticsearch Python client works with OpenSearch

Actual behaviour

https://github.com/elastic/elasticsearch-py/issues/1667

Steps to reproduce the behaviour

  1. Attempt to connect to OpenSearch cluster with latest Elasticsearch client using the elasticsearch7 backend

Recommended Steps

Support OpenSearch (API compatible with Elasticsearch 7) as a backend https://opensearch.org/docs/latest/clients/python/

Configuration

  • Operating system version: Debian 11 Bullseye
  • Search engine version: Elasticsearch 7
  • Python version: 3.8
  • Django version: 2.2.23
  • Haystack version: 3.1.1

automartin5000 avatar Nov 17 '21 17:11 automartin5000

Are there any updates?

artemijan avatar Dec 13 '21 10:12 artemijan

I have a working setup.

I have this in my setting:

HAYSTACK_CONNECTIONS = {
    'default': {
        'ENGINE': 'haystack.backends.elasticsearch7_backend.Elasticsearch7SearchEngine',
        'URL': 'http://127.0.0.1:9200/',
        'INDEX_NAME': 'site-haystack',
    },
}

Using:

  • django-haystack==3.1.1
  • django==3.1.9
  • elasticsearch==7.13.3
  • python 3.8.7

latest opensearch from homebrew. (opensearch 1.2.4)

The commands update_index and rebuild_index work and my search functionality also works on my test setup.

svandeneertwegh avatar Feb 09 '22 15:02 svandeneertwegh

Is the correct resolution to implement an opensearch_backend that's based on elasticsearch7_backend, but uses opensearch-py instead?

@acdha Looks like you're the most active recent maintainer; any thoughts?

bhrutledge avatar Apr 19 '22 19:04 bhrutledge

@bhrutledge I tried that, but ended down a rabbit hole of incompatible APIs: https://github.com/automartin5000/django-haystack

automartin5000 avatar Apr 19 '22 19:04 automartin5000