Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Views on supporting both Elasticsearch and OpenSearch #415

Open
barseghyanartur opened this issue Jul 27, 2022 · 11 comments
Open

Views on supporting both Elasticsearch and OpenSearch #415

barseghyanartur opened this issue Jul 27, 2022 · 11 comments

Comments

@barseghyanartur
Copy link
Contributor

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
Copy link
Contributor Author

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

@barseghyanartur
Copy link
Contributor Author

@safwanrahman

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

@barseghyanartur
Copy link
Contributor Author

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

@safwanrahman
Copy link
Collaborator

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

@barseghyanartur
Copy link
Contributor Author

@safwanrahman:

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

@barseghyanartur
Copy link
Contributor Author

Ping.

@safwanrahman
Copy link
Collaborator

@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.

@barseghyanartur
Copy link
Contributor Author

barseghyanartur commented Aug 14, 2022

@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.

@safwanrahman
Copy link
Collaborator

@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?

@a3kov
Copy link

a3kov commented Sep 2, 2022

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.

@barseghyanartur
Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants