django-elasticsearch-dsl icon indicating copy to clipboard operation
django-elasticsearch-dsl copied to clipboard

Views on supporting both Elasticsearch and OpenSearch

Open barseghyanartur opened this issue 3 years ago • 11 comments

I've been working on a version of django-elasticsearch-dsl-drf that would support both Elasticsearch and OpenSearch. Looked into the a fork of this library (django-opensearch-dsl), couldn't make it working (as it has differences), then forked this one, patched it and ran through a comprehensive series of tests (that I've written for django-elasticsearch-dsl-drf, totaling 158, Elasticsearch 7.x only).

ATM, both Elasticsearch and OpenSearch work just fine in my branch.

It works with help of anysearch which does necessary import replacements depending on which one (Elasticsearch or OpenSearch) is chosen (similarly to what six package does to support both 2.x and 3.x branches of Python).

  • Both elasticsearch and elasticsearch-dsl become optional dependencies (as well as opensearch-py and opensearch-dsl) and are installed when instructed (like pip install django-elasticsearch-dsl[elasticsearch] or pip install django-elasticsearch-dsl[opensearch]).
  • anysearch becomes a required dependency.

The question is, would you accept a PR for this (and thus be willing to support both Elasticsearch and OpenSearch)?

barseghyanartur avatar Jul 27 '22 00:07 barseghyanartur

P.S. Please, take a look at the diff (very minimal).

barseghyanartur avatar Jul 27 '22 00:07 barseghyanartur

@safwanrahman

No is also a good answer. I at least would know what to do further.

barseghyanartur avatar Jul 29 '22 21:07 barseghyanartur

In two days from now, I'll take it as no.

barseghyanartur avatar Aug 01 '22 12:08 barseghyanartur

I am on travel with limited internet connection, will be back to the issue after 6th August

safwanrahman avatar Aug 01 '22 12:08 safwanrahman

@safwanrahman:

Ah, I didn't expect that. Fair enough. I'll park it until then. Thanks for answering! :1st_place_medal:

barseghyanartur avatar Aug 01 '22 12:08 barseghyanartur

Ping.

barseghyanartur avatar Aug 13 '22 10:08 barseghyanartur

@barseghyanartur Thanks for raising this and pinging me. I am sorry for the late reply as I needed some time to cope up with some unfinished personal work after travel.

I am not comfortable to serve both elasticsearch and opensearch at the same time and it makes this project quite complex to maintain both different (but similar) engine. I have seen django-opensearch-dsl and it seems like it is good place to have support OpenSearch. Both project can collaborate like we can cherry peak and port each others commit for specific feature or take inspiration for that project for certain features.

safwanrahman avatar Aug 14 '22 16:08 safwanrahman

@safwanrahman:

Some thoughts from my side. I consider this project very small but very useful. The main purpose is the sync of data between Elasticsearch and Django - a very small but exceptionally valuable purpose.

I've seen the django-opensearch-dsl, but I consider it a useless fork, because nothing worked for me, although I tried. The anysearch project initially did have support for both django-elasticsearch-dsl and django-opensearch-dsl, but I had to discard it, since the two are incompatible.

Unfortunately, you leave me no other choice, that to re-brand and maintain my own fork of this project (which I very much dislike), but since I do want to support both OpenSearch and Elasticsearch in django-elasticsearch-dsl-drf, that's the only feasible way.

I'll try to make best of it and it will be a friendly fork. If you change your mind later on, I'll be happy to have things merged into this one.

barseghyanartur avatar Aug 14 '22 20:08 barseghyanartur

@barseghyanartur I can understand your point. What we can do is create a fork of this repository with your changes and create a seperate repo like django-opensearch-dsl2 in this organization. I can add yourself as a maintainer at that repository.

After that, we can cherry pick and port new features for both of the repository. What do you think?

safwanrahman avatar Aug 17 '22 12:08 safwanrahman

I also don't see the point of supporting both OpenSearch and Elasticsearch. Yes, now it may work the same, but it is clear in the long run it is not sustainable as the projects went on their own paths and for later versions of Elasticsearch the difference from OpenSearch may become more drastic.

a3kov avatar Sep 02 '22 10:09 a3kov

Yet experimental backlink: https://pypi.org/project/django-anysearch-dsl/

barseghyanartur avatar Dec 30 '22 23:12 barseghyanartur