Request for Elasticsearch-rails fork

Hi, is there any chance of a fork for elasticsearch-rails (GitHub - elastic/elasticsearch-rails: Elasticsearch integrations for ActiveModel/Record and Ruby on Rails) with the new client libraries?

It looks to be built using the same underlying gems as elasticsearch-ruby which was on the list of libraries intended to be forked, but offers a lot of nice benefits to Rails applications specifically.

Thanks

2 Likes

Hey Sam! That’s a good question. It’s not currently on the list that I’ve seen, but that doesn’t mean things are settled.

Let me turn this around since I’m not super involved in Ruby or rails.

  • What does this block for you?
  • Is there another way to utilize the existing rails library with opensearch-ruby? (e.g. can you pass in an alternate client library)

Thanks for getting back to me. Those are also great questions, I opened this thread on behalf of the company I work for as we currently use elasticsearch-rails, but I don’t maintain that part of our app so I don’t think I’m best placed to answer them.

I’ve asked a couple of my colleagues who work on that area and know a lot more about elasticsearch than I to share their thoughts here, they should get back to you shortly after the weekend.

Thanks again

1 Like

Elasticsearch Rails is split into two parts
elasticsearch-rails which provides some instrumentation such as nice logging the time that queries took. It also adds some nice rake task (which are dependent on elasticsearch-model) but neither of these are essential

elasticsearch-model provides some nice abstractions for us

  • Adds callbacks for model indexing
  • easy importing of models into ES
  • set up an indexes and there mappings in ruby
  • multi model search
  • set index name and document type
  • paginatation of results

However it does allow us to configure a client https://github.com/elastic/elasticsearch-rails/tree/master/elasticsearch-model#the-elasticsearch-client if your version of elasticsearch-ruby follows the same api i wonder if we could drop this in here?

If this isnt possible, it will mean that we will have to re write all this stuff as out of the box elasticsearch ruby is just a client for ES which would be quite an overhead for us as currently we have a working implementation.

2 Likes

In theory, If you can configure a client, I think you could drop in the OpenSearch client - all these forks are supposed to be syntax compatible if the language allows.

However, if that’s controlled by Elastic it might just be a matter of time before dropping in an OpenSearch client is blocked.

1 Like

Yeah, that is my fear… it is outside of our control and they are taking steps to stop their stuff working with opensearch.

Here is the good news about this particular library - it’s slow moving. Many of the other client libraries for Elasticsearch use lock-step versioning - Elasticsearch Version === Client Library version. This one doesn’t seem to work that way.

Net/net: Should there be a specific block put into place it would give the community time to react accordingly and the existing versions will still be fine.

Sounds good. Thanks for you help investigating this. Look forward to testing the new opensearch ruby library with this library

1 Like

For background
gem elasticsearch-model has been downloaded 31,102,064 times.
gem elastichsearch-rails has been downloaded 26,713,770 times.

Those seem pretty popular in the ruby community for ES.

Our app codebase utilizes a lot of elastic-model usage. It seems unclear this has been addressed by anyone yet? I didn’t understand the client comment, using gem elasticsearch-model then includes elasticsearch which causes the unsupported message. So did you solve the ability of your code to use elasticsearch-model or some equivalent? Or did you delay your OpenSearch plans?

Would be happy with an opensearch-rails and opensearch-model gem, even if we had to change the sourcecode to use opensearch everywhere a class was referenced.

At this point just trying to make a plan with options and am surprised there aren’t more people running into this same ruby issue since there is not a lot of information about it on the internet anywhere yet. It’s definitely blocking the plans for OpenSearch I was hoping.

We are also trying to switch to OpenSearch and appreciate the commitment for gem opensearch-ruby. However our code also uses gem elasticsearch-model, gem elasticsearch-rails and I’m finding nothing on the internet about ruby applications that utilize those how to make them work with OpenSearch. My guess it they would also have to be forked, and code re-worked to use OpenSearch instead of ElasticSearch language throughout our app codebase? It seems elasticsearch-model has a dependency to elasticsearch which leads to that unsupported message. Sticking with the <7.14 versions by elastic is not a very long term solution. So re-opening this since I can’t find info on the internet about anyone else running into the same issue, in case someone else search the same. Would really like to jump on the OpenSearch bandwagon if anyone has a solution. cc: @searchymcsearchface @hvenables

1 Like

Hi, We are looking at Opensearch option too. Any light where we are with Rails client libraries will be helpful for us to make the decision.