Skip to main content

Elasticsearch 与 asyncio 的集成。

项目描述

aioes是一个与Elasticsearch配合使用的异步兼容库

https://travis-ci.org/aio-libs/aioes.svg?branch=master https://codecov.io/gh/aio-libs/aioes/branch/master/graph/badge.svg

文档

在 Read The Docs 上阅读aioes文档:http: //aioes.readthedocs.io/

例子

import asyncio
from aioes import Elasticsearch

@asyncio.coroutine
def go():
    es = Elasticsearch(['localhost:9200'])
    ret = yield from es.create(index="my-index",
                               doc_type="test-type",
                               id=42,
                               body={"str": "data",
                                     "int": 1})
    assert (ret == {'_id': '42',
                    '_index': 'my-index',
                    '_type': 'test-type',
                    '_version': 1,
                    'ok': True})

    answer = yield from es.get(index="my-index",
                               doc_type="test-type",
                               id=42)
    assert answer['_source'] == {'str': 'data', 'int': 1}

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

要求

测试

在执行测试之前,请确保您有一个在端口 9200 上运行的 Elasticsearch 实例。

为了使所有测试正常工作,您需要在 config/elasticsearch.yml配置文件中添加以下行:

启用 groovy 脚本:

script.groovy.sandbox.enabled: true

设置存储库路径:

path.repo: ["/tmp"]

测试套件使用py.test,只需运行:

$ py.test

执照

aioes 在 BSD 许可下提供。

变化

0.7.2 (2017-04-19)

  • 允许在传输中使用自定义连接器:#138、#137。

  • 修复了文档中的几个拼写错误。

0.7.0 (2017-03-29)

  • 修复 Elasticsearch 5.x 兼容性问题:#48、#72、#112、#73、#123。

  • stored_fields添加到mgetsearchexplain方法 (#123)。

  • 在health (#123)中添加wait_for_no_relocating_shards参数。

  • 分析(#123)中添加filtertoken_filterchar_filter参数。

  • 添加force_merge方法(重命名优化)(#123)。

  • 在 hot_threads #123 中添加 ignore_idle_threads 参数。

  • 更新项目依赖项。

  • 将测试转换为 pytest。

0.6.1 (2016-09-08)

  • 接受字节作为有效载荷 #42

  • Elasticsearch.close()转换为协程。

0.6.0 (2016-09-08)

  • 添加对 verify_ssl #43 的支持

0.5.0 (2016-07-16)

  • 允许连接中的方案、用户名和密码 #40

0.4.0 (2016-02-10)

  • 修复传输地址正则表达式中的 ES2+ 兼容性 #38

0.3.0 (2016-01-27)

  • 在内部使用 aiohttp.ClientSession #36

0.2.0 (2015-10-08)

  • 与 Elasticsearch 1.7 兼容

  • 支持 Python 3.5

  • 放弃 Python 3.3 支持

  • Apache 2 下的再许可

0.1.0 (2014-10-04)

  • 初始发行

项目详情


下载文件

下载适用于您平台的文件。如果您不确定要选择哪个,请了解有关安装包的更多信息。

源分布

aioes-0.7.2.tar.gz (65.2 kB 查看哈希

已上传 source

内置分布

aioes-0.7.2-py3-none-any.whl (31.7 kB 查看哈希

已上传 py3