You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/reference/async.md
+21Lines changed: 21 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -50,6 +50,27 @@ All APIs that are available under the sync client are also available under the a
50
50
51
51
See also the [Using OpenTelemetry](/reference/opentelemetry.md) page.
52
52
53
+
## Trio support
54
+
55
+
If you prefer using Trio instead of asyncio to take advantage of its better structured concurrency support, you can use the HTTPX async node which supports Trio out of the box.
56
+
57
+
```python
58
+
import trio
59
+
from elasticsearch import AsyncElasticsearch
60
+
61
+
client = AsyncElasticsearch(
62
+
"https://...",
63
+
api_key="...",
64
+
node_class="httpxasync")
65
+
66
+
asyncdefmain():
67
+
resp =await client.info()
68
+
print(resp.body)
69
+
70
+
trio.run(main)
71
+
```
72
+
73
+
The one limitation of Trio support is that it does not currently support node sniffing, which was not implemented with structured concurrency in mind.
Copy file name to clipboardExpand all lines: docs/reference/dsl_how_to_guides.md
+14-2Lines changed: 14 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1555,6 +1555,12 @@ The DSL module supports async/await with [asyncio](https://docs.python.org/3/lib
1555
1555
$ python -m pip install "elasticsearch[async]"
1556
1556
```
1557
1557
1558
+
The DSL module also supports [Trio](https://trio.readthedocs.io/en/stable/) when using the Async HTTPX client. You do need to install Trio andHTTPX separately:
0 commit comments