def invenio_query_factory(parser=None, walkers=None):
    """Create a parser returning Elastic Search DSL query instance."""
    parser = parser or Main
    walkers = walkers or [PypegConverter()]
    walkers.append(ElasticSearchDSL())

    def invenio_query(pattern):
        query = pypeg2.parse(pattern, parser, whitespace="")
        for walker in walkers:
            query = query.accept(walker)
        return query
    return invenio_query
Create a parser returning Elastic Search DSL query instance.