django-es / django-elasticsearch-dsl

This is a package that allows indexing of django models in elasticsearch with elasticsearch-dsl-py.
Other
1.02k stars 262 forks source link

Views on supporting both Elasticsearch and OpenSearch #415

Open barseghyanartur opened 2 years ago

barseghyanartur commented 2 years ago

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

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

barseghyanartur commented 2 years ago

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

barseghyanartur commented 2 years ago

@safwanrahman

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

barseghyanartur commented 2 years ago

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

safwanrahman commented 2 years ago

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

barseghyanartur commented 2 years ago

@safwanrahman:

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

barseghyanartur commented 2 years ago

Ping.

safwanrahman commented 2 years ago

@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 commented 2 years ago

@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 commented 2 years ago

@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 commented 2 years ago

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 commented 1 year ago

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