用于elasticsearch的非官方python客户端
predikto-elasticsearch的Python项目详细描述
用于ElasticSearch的非官方低级客户端。它的目标是在官方弹性搜索py的基础上稍加扩展 库,同时在过渡期间提供更频繁的发布。具体来说,我们正在使用elasticsearch 2.x, 1.x不受支持,5.x可能是事后考虑。为了支持这两种方案中的任何一种,请转到主回购协议
相容性
- 在使用fork时,最新版本的elasticsearch 2.x版本是2.4.0,因此
- 预测弹性搜索Py将为2.4.1。
示例使用
简单用例:
>>> from datetime import datetime >>> from elasticsearch import Elasticsearch # by default we connect to localhost:9200 >>> es = Elasticsearch() # create an index in elasticsearch, ignore status code 400 (index already exists) >>> es.indices.create(index='my-index', ignore=400) {u'acknowledged': True} # datetimes will be serialized >>> es.index(index="my-index", doc_type="test-type", id=42, body={"any": "data", "timestamp": datetime.now()}) {u'_id': u'42', u'_index': u'my-index', u'_type': u'test-type', u'_version': 1, u'ok': True} # but not deserialized >>> es.get(index="my-index", doc_type="test-type", id=42)['_source'] {u'any': u'data', u'timestamp': u'2013-05-12T19:45:31.804229'}
功能
客户的功能包括:
- translating basic Python data types to and from json (datetimes are not decoded for performance reasons)
- configurable automatic discovery of cluster nodes
- persistent connections
- load balancing (with pluggable selection strategy) across all available nodes
- failed connection penalization (time based - failed connections won’t be retried until a timeout is reached)
- support for ssl and http authentication
- thread safety
- pluggable architecture
许可证
2015 ElasticSearch版权所有
根据apache许可证2.0版(以下简称“许可证”)授权; 除非符合许可证,否则您不能使用此文件。 你可以在
http://www.apache.org/licenses/LICENSE-2.0
除非适用法律要求或书面同意,否则软件 根据许可证分发是按“原样”分发的, 无任何明示或默示的保证或条件。 有关管理权限的特定语言和 许可下的限制