跳转到主要内容

Elasticsearch的Python客户端

项目描述

https://img.shields.io/pypi/v/elasticsearch https://img.shields.io/conda/vn/conda-forge/elasticsearch?color=blue https://pepy.tech/badge/elasticsearch https://clients-ci.elastic.co/job/elastic+elasticsearch-py+master/badge/icon https://readthedocs.org/projects/elasticsearch-py/badge/?version=latest&style=flat

Elasticsearch的官方Python客户端。

功能

  • 将基本Python数据类型转换为JSON和从JSON转换

  • 可配置的自动发现集群节点

  • 持久连接

  • 跨可用节点进行负载均衡(具有可插拔的选择策略)

  • 失败的连接惩罚(基于时间的 - 失败的连接将在超时达到之前不会重试)

  • 支持TLS和HTTP身份验证

  • 请求之间的线程安全性

  • 可插拔架构

  • 辅助函数,用于惯用方式使用API

安装

使用pip安装elasticsearch软件包,链接:pip

$ python -m pip install elasticsearch

如果你的应用程序使用Python中的async/await,可以使用async附加组件进行安装

$ python -m pip install elasticsearch[async]

有关如何使用asyncio与该项目一起使用的更多信息,请参阅这里

兼容性

语言客户端是向前兼容的;这意味着客户端支持与Elasticsearch的更高或相同的小版本通信。Elasticsearch语言客户端仅向后兼容默认发行版,且无任何保证。

如果你需要同时安装多个版本,较旧版本也以elasticsearch2elasticsearch5的形式发布。

文档

客户端文档可在elastic.coRead the Docs上找到。

快速入门

# Import the client from the 'elasticsearch' module
>>> from elasticsearch import Elasticsearch

# Instantiate a client instance
>>> client = Elasticsearch("http://localhost:9200")

# Call an API, in this example `info()`
>>> resp = client.info()

# View the result
>>> resp
{
  "name" : "instance-name",
  "cluster_name" : "cluster-name",
  "cluster_uuid" : "cluster-uuid",
  "version" : {
    "number" : "7.14.0",
    ...
  },
  "tagline" : "You know, for Search"
}

你可以在文档中阅读有关如何配置客户端的更多信息。

许可

版权所有 2021 Elasticsearch B.V. 依据Apache许可证第2.0版授权。

项目详情


下载文件

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

源分发

elasticsearch7-7.17.12.tar.gz (248.1 kB 查看哈希值)

上传时间

构建分发

elasticsearch7-7.17.12-py2.py3-none-any.whl (386.4 kB 查看哈希)

上传于 Python 2 Python 3

支持者