Skip to content

aio-libs/aioelasticsearch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

81b6ae3 · Jan 22, 2022
Jun 4, 2020
Jun 4, 2020
Feb 14, 2018
Jul 28, 2017
Nov 7, 2019
Jun 4, 2020
Jan 19, 2018
Mar 17, 2017
Jan 19, 2018
Aug 22, 2017
Jan 22, 2022
Aug 8, 2017
Nov 7, 2019
Jun 2, 2019

Repository files navigation

aioelasticsearch

info:elasticsearch-py wrapper for 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

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 doc in scan:
                print(doc['_source'])

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

Thanks

The library was donated by Ocean S.A.

Thanks to the company for contribution.