Skip to content

Initialize an instance of Search from_hash #22

@j-bennet

Description

@j-bennet

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions