elastic / elastic/elasticsearch-dsl-ruby

Initialize an instance of Search from_hash

Open
#22 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Ruby
Stars
18
Forks
16
PR merge metrics
No merged PRs in 30d

Description

Hi,

I'm trying to figure out how to initialize an instance of `Elasticsearch::DSL::Search::Search` from a hash, pretty much a complete reverse of `to_hash`. The idea is to take the json query provided by the user, convert it to hash, instantiate a `Search`, and enrich it with some additional clauses and options before issuing a request to Elasticsearch. Of course, I could update the user's hash, but being able to use the DSL seems so much nicer and a lot less clunky - if only it worked. It looks like currently this use case is unsupported - the purpose of this library is to go from Ruby DSL to Elasticsearch hashes, not backwards. However, I can't help wondering if perhaps other people ran into the same problem. Can you offer any help / advice?

Thank you.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.