Skip to main content
Help us improve Python packaging – donate today!

Lightweight python wrapper for elasticsearch.

Project Description

A Python client for elasticsearch.

Usage

pyelasticsearch handles the low-level interactions with elasticsearch, allowing you to use native Python datatypes to index or perform queries.

Example:

conn = ElasticSearch('http://localhost:9200/')

# Index some documents.
conn.index({"name":"Joe Tester", "age": 25, "title": "QA Master"}, "contacts", "person", 1)
conn.index({"name":"Jessica Coder", "age": 32, "title": "Programmer"}, "contacts", "person", 2)
conn.index({"name":"Freddy Tester", "age": 29, "title": "Office Assistant"}, "contacts", "person", 3)

# Refresh the index to pick up the latest documents.
conn.refresh(["contacts"])

# Get just Jessica's document.
jessica = conn.get("contacts", "person", 2)

# Perform a simple search.
results = conn.search("name:joe OR name:freddy")

# Perform a search using the elasticsearch Query DSL (http://www.elasticsearch.org/guide/reference/query-dsl)
query = {
    "query_string": {
        "query": "name:tester"
    },
    "filtered": {
        "filter": {
            "range": {
                "age": {
                    "from": 27,
                    "to": 37,
                },
            },
        },
    },
}
results = conn.search(query)

# Clean up.
conn.delete_index("contacts")

For more examples, please check out the doctests & tests.py.

License

Licensed under the New BSD license.

Credits

Used pysolr as a jumping off point - thanks guys.

Release history Release notifications

History Node

1.4.1

History Node

1.4

History Node

1.3

History Node

1.2.4

History Node

1.2.3

History Node

1.2.2

History Node

1.2.1

History Node

1.2

History Node

1.1

History Node

1.0

History Node

0.7.1

History Node

0.7

History Node

0.6.1

History Node

0.6

History Node

0.5

History Node

0.4.1

History Node

0.4

History Node

0.3

History Node

0.2

This version
History Node

0.1

History Node

0.0.6

History Node

0.0.5

Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
pyelasticsearch-0.1.tar.gz (7.5 kB) Copy SHA256 hash SHA256 Source None Aug 30, 2012

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page