Skip to content

hellysmile/aioelasticsearch

 
 

Repository files navigation

aioelasticsearch

info:aioelasticsearch-py wrapper asyncio

Installation

pip install aioelasticsearch

Usage

import asyncio

from aioelasticsearch import Elasticsearch

async def go():
    es = Elasticsearch()

    print(await es.search())

    await es.close()

loop = asyncio.get_event_loop()
loop.run_until_complete(go())
loop.close()

Features

Asynchronous scroll <https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-scroll.html>

import asyncio

from aioelasticsearch import Elasticsearch
from aioelasticsearch.helpers import Scan

async def go():
    async with Elasticsearch() as es:
        async with Scan(
            es
            index='index',
            doc_type='doc_type',
            query={},
        ) as scan:
            print(scan.total)

            async for scroll in scan:
                for doc in scroll:
                    print(doc['_source'])

loop = asyncio.get_event_loop()
loop.run_until_complete(go())
loop.close()

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%