Initialize an instance of Search from_hash
j-bennet opened this issue · comments
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.