https://github.com/fabregas/asynces
Asyncio driver for Elasticsearch
https://github.com/fabregas/asynces
asyncio elasticsearch python-3
Last synced: 7 months ago
JSON representation
Asyncio driver for Elasticsearch
- Host: GitHub
- URL: https://github.com/fabregas/asynces
- Owner: fabregas
- License: apache-2.0
- Created: 2017-02-05T18:12:52.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2021-02-26T02:12:40.000Z (over 5 years ago)
- Last Synced: 2024-09-28T22:42:39.939Z (over 1 year ago)
- Topics: asyncio, elasticsearch, python-3
- Language: Python
- Size: 30.3 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# asynces
[](https://travis-ci.org/fabregas/asynces)
[](https://codecov.io/gh/fabregas/asynces)
### Asyncio driver for Elasticsearch and Python 3.5+
Its goal is to create an asyncio transport for the official elasticsearch python driver.
The **asynces** package provides the AsyncElasticsearch class inherited from
the Elasticsearch class (see [elasticsearch](https://elasticsearch-py.readthedocs.io/en/master/index.html)).
All methods from the Elasticsearch class instance (see [API doc](http://elasticsearch-py.readthedocs.io/en/master/api.html))
are available in the AsyncElasticsearch class instance.
Each API method returns [coroutine](https://docs.python.org/3/library/asyncio-task.html#coroutines) that must be awaited.
Example of asynces usage:
```python
import asyncio
from asynces import AsyncElasticsearch
async def test(loop):
es = AsyncElasticsearch('http://127.0.0.1:9200/', loop=loop)
doc = {'hello': 'world'}
await es.index(index='my-index', doc_type='test', body=doc, refresh=False)
await es.indices.refresh(index="my-index")
ret = await es.search(index='my-index')
print(ret)
es.close()
loop = asyncio.get_event_loop()
loop.run_until_complete(test(loop))
loop.close()
```
## Installation
First, you should install the latest version of [elasticsearch](https://elasticsearch-py.readthedocs.io/en/master/index.html#compatibility)
compatible with your elasticsearch server version.
After that you should install asynces package:
> pip install asynces