asyncio driver for elasticsearch
Project description
# asynces
[![Build Status](https://travis-ci.org/fabregas/asynces.svg?branch=master)](https://travis-ci.org/fabregas/asynces)
[![codecov](https://codecov.io/gh/fabregas/asynces/branch/master/graph/badge.svg)](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
[![Build Status](https://travis-ci.org/fabregas/asynces.svg?branch=master)](https://travis-ci.org/fabregas/asynces)
[![codecov](https://codecov.io/gh/fabregas/asynces/branch/master/graph/badge.svg)](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
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
asynces-0.1.5.tar.gz
(10.0 kB
view details)
File details
Details for the file asynces-0.1.5.tar.gz
.
File metadata
- Download URL: asynces-0.1.5.tar.gz
- Upload date:
- Size: 10.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 217e6cc97f3fab947763b347dff99b57522ebbbe73c1e105487d6e0756592a76 |
|
MD5 | c867f9f09faef1df5154a0cec8f7778d |
|
BLAKE2b-256 | ed91741eb62d6a8c92b72a0cf3af6514788fb57f102f7a09c2cff4061016941a |