Django Querysets-esque implementation for Elasticsearch
Project description
# PyEQS [![Build Status](https://travis-ci.org/Yipit/pyeqs.svg)](https://travis-ci.org/Yipit/pyeqs) [![Coverage Status](https://coveralls.io/repos/Yipit/pyeqs/badge.png)](https://coveralls.io/r/Yipit/pyeqs)
#### Python Elasticsearch QuerySets
A python library to simplify building complex Elasticsearch JSON queries. Based on the Django QuerySet API.
## Installation
```bash
pip install pyeqs
```
## Usage
Simple querying
```python
from pyeqs import QuerySet
qs = QuerySet("http://localhost:9200", index="my_index")
print qs._query
"""
{
'query': {
'match_all': {}
}
}"""
```
Simple Filtering
```python
from pyeqs import QuerySet
from pyeqs.dsl import Term
qs = QuerySet("http://localhost:9200", index="my_index")
qs.filter(Term("foo", "bar"))
print qs._query
"""
{
'query': {
'filtered': {
'filter': {
'and': [
{
'term': {
'foo': 'bar'
}
}
]
},
'query': {
'match_all': {}
}
}
}
}"""
```
## Contributing
* Fork the `git` repo
* Download the forked `git` repo
* Create a branch for your changes
* Link the `pre-commit` hook to `.git/hooks/pre-commit`
* Run the tests, *before you make changes*, to make sure everything works
* Change the code for your PR
* Write (or modify) tests to make sure your changes work
* Submit a Pull Request
#### Python Elasticsearch QuerySets
A python library to simplify building complex Elasticsearch JSON queries. Based on the Django QuerySet API.
## Installation
```bash
pip install pyeqs
```
## Usage
Simple querying
```python
from pyeqs import QuerySet
qs = QuerySet("http://localhost:9200", index="my_index")
print qs._query
"""
{
'query': {
'match_all': {}
}
}"""
```
Simple Filtering
```python
from pyeqs import QuerySet
from pyeqs.dsl import Term
qs = QuerySet("http://localhost:9200", index="my_index")
qs.filter(Term("foo", "bar"))
print qs._query
"""
{
'query': {
'filtered': {
'filter': {
'and': [
{
'term': {
'foo': 'bar'
}
}
]
},
'query': {
'match_all': {}
}
}
}
}"""
```
## Contributing
* Fork the `git` repo
* Download the forked `git` repo
* Create a branch for your changes
* Link the `pre-commit` hook to `.git/hooks/pre-commit`
* Run the tests, *before you make changes*, to make sure everything works
* Change the code for your PR
* Write (or modify) tests to make sure your changes work
* Submit a Pull Request
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pyeqs-0.3.0.tar.gz
(6.3 kB
view details)
File details
Details for the file pyeqs-0.3.0.tar.gz
.
File metadata
- Download URL: pyeqs-0.3.0.tar.gz
- Upload date:
- Size: 6.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e0d31d377345cf4d8e64f540e88503236a820aefd5cb16efd89220fb496d733c |
|
MD5 | a27eeba0c1f9b3ed57b36b805d219c57 |
|
BLAKE2b-256 | c62498ed934bf9d5e42b41a27195c76ded528713a39533006a96814beae1ddb0 |