Elasticsearch data layer for eve rest framework
Project description
Eve-Elastic is elasticsearch data layer for eve REST framework.
Features
fulltext search
filtering via elasticsearch filter dsl
facets support
aggragations support
elasticsearch mapping generator for schema
License
Eve-Elastic is GPLv3 licensed.
Install
$ pip install Eve-Elastic
Usage
Set elastic as your eve data layer.
import eve
from eve_elastic import Elastic
app = eve.Eve(data=Elastic)
Config
There are 2 options for Eve-Elastic taken from app.config:
ELASTICSEARCH_URL (default: 'http://localhost:9200/')
ELASTICSEARCH_INDEX - (default: 'eve')
Query params
Eve-Elastic supports eve like queries via where param which work as term filter.
On top of this, there is a predefined query_string query which does fulltext search.
$ curl http://localhost:5000/items?q=foo&df=name
q - query (default: *)
df - default field (default: _all)
Filtering
For more sophisticated filtering, you can use filter query param which will be used as filter for the query, using elastic filter dsl.
Facets
To add a facets support for specific resource, add facets into its datasource:
DOMAIN = {
'contacts': {
'datasource':
'facets': {
'urgency': {'terms': {'field': 'urgency'}},
'versioncreated': {'date_histogram': {'field': 'versioncreated', 'interval': 'hour'}}
}
}
}
You will find more info about facets in elasticsearch docs.
Changelog
0.2.1 (2014-11-27)
allow resource filters being callbacks for request specific filtering
0.2.0 (2014-11-24)
fix q param search for using eve <= 0.4
fix filters request args filtering
let user set mapping in schema
support aggregations
0.1.17 (2014-11-12)
switch to elasticsearch lib
add factory for es and indices
0.1.13 (2014-07-21)
fix count to allow extra params
0.1.12 (2014-07-08)
fix for superdesk search_backend setting
0.1.11 (2014-06-27)
add custom json serializer to work with bson.ObjectId
0.1.10 (2014-06-11)
fix is_empty
0.1.9 (2014-05-29)
fix is_empty call
implement find_one_raw
0.1.8 (2014-05-29)
fix remove by lookup
0.1.7 (2014-05-28)
preserve mapping after deleting all documents for given type
0.1.6 (2014-05-09)
support source param on find
0.1.5 (2014-05-05)
fix for elastic 1.0+ fields handling
0.1.4 (2014-05-02)
make it work with elastic 1.0+
0.1.3 (2014-01-31)
allow filtering via elasticsearch filter dsl
0.1.2 (2014-01-30)
fix pip install (add missing MANIFEST file)
0.1.1 (2014-01-30)
add changelog ;)
migrate readme to rst and use it for long_description
0.1.0 (2014-01-28)
initial release
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
File details
Details for the file Eve-Elastic-0.2.1.tar.gz
.
File metadata
- Download URL: Eve-Elastic-0.2.1.tar.gz
- Upload date:
- Size: 43.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c81ce91b87468f72d91d080c437a91be30c036532a5540f88f5c08f66c717cc6 |
|
MD5 | c654f0cba11762409bbe810e0ace0085 |
|
BLAKE2b-256 | 34474daef8e455b3d3ec62e7d3ffadb157ad732341cf4fd668937e9cd5e4632f |