Skip to content
This repository has been archived by the owner on Mar 20, 2023. It is now read-only.

Compatible with elasticsearch-dsl #31

Closed
digitaldavenyc opened this issue Dec 7, 2017 · 3 comments
Closed

Compatible with elasticsearch-dsl #31

digitaldavenyc opened this issue Dec 7, 2017 · 3 comments

Comments

@digitaldavenyc
Copy link

Is it possible to use this with elasticsearch-dsl?

@digitaldavenyc digitaldavenyc changed the title Use with elasticsearch-dsl Compatible with elasticsearch-dsl Dec 7, 2017
@0bsearch
Copy link

0bsearch commented Dec 22, 2017

Not as drop-in replacement.

Dsl does a lot of sync calls, i.e. DocType.save() or Search.execute(). You need to subclass and change it to await calls from underlying async transport.

@udfalkso
Copy link

udfalkso commented Jul 1, 2019

The DSL Search has a to_dict() method that you can then pass as the body to the async es client. Seems to work for me.

Something like this:

from elasticsearch_async import AsyncElasticsearch
es = AsyncElasticsearch(hosts=["localhost"])

q = # build your query
s = Search(index=INDEX_NAME).query(q)
r = await es.search(index=INDEX_NAME, body=s.to_dict())

@sethmlarson
Copy link
Contributor

This issue is being tracked on the Elasticsearch-DSL repository here: elastic/elasticsearch-dsl-py#1355
Closing in favor of that issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants