Skip to main content

Unofficial Python client for Elasticsearch

Project description

Unofficial low-level client for Elasticsearch. Its goal is to be a slight extension of the official elasticsearch-py library, while providing more frequent releases in the interim. Specifically, we are working with elasticsearch 2.x, 1.x is not supported, and 5.x is probably an afterthought. For support of either of those two, head to the main repo.

Compatibility

At the time of the fork, the most recent version of the elasticsearch 2.x version was 2.4.0, so the first release of

predikto-elasticsearch-py will be 2.4.1.

Installation

Install the elasticsearch package with pip:

pip install predikto-elasticsearch

Example use

Simple use-case:

>>> 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'}

Features

The client’s features include:

  • 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

License

Copyright 2015 Elasticsearch

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

predikto-elasticsearch-2.4.1.tar.gz (58.2 kB view details)

Uploaded Source

File details

Details for the file predikto-elasticsearch-2.4.1.tar.gz.

File metadata

File hashes

Hashes for predikto-elasticsearch-2.4.1.tar.gz
Algorithm Hash digest
SHA256 ee5c4160166b424689bd70bfb80675db4c1befa6dd1c4350aeffd0851e134646
MD5 2774d621365b651c087fabb66180c176
BLAKE2b-256 b6798ca9603a3c6d5062cc9bb18d08b821d7d668b944deac8a9389d1cec246c4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page