Skip to main content

Elasticsearch data layer for eve rest framework

Project description

https://travis-ci.org/petrjasek/eve-elastic.png?branch=master

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.21 (2015-11-20)

  • try to put settings in case put mapping is failing

0.2.20 (2015-11-16)

  • make it possible to specify index settings (by Mayur Dhamanwala)

0.2.19 (2015-09-29)

  • use ELASTICSEARCH_URL value as is so that it works with auth and https

0.2.18 (2015-08-12)

  • throw InvalidSearchString exception in case elastic returns SearchParseException (by Mugur Rus)

0.2.17 (2015-08-11)

  • add support for phase search via q param (by Mugur Rus)

0.2.16 (2015-08-04)

  • fix pip install

0.2.15 (2015-08-04)

  • parse mapping for fields type dict

  • avoid hidden dependencies - put it in requirements file (by Dinu Ghermany)

0.2.14 (2015-07-31)

  • avoid pymongo dependency

0.2.13 (2015-07-22)

  • add default_operator param to _build_query_string (by Mugur Rus)

0.2.12 (2015-07-07)

  • use both resource and datasource schema to convert datetime values (by Anca Farcas)

0.2.11 (2015-06-22)

  • return no hits when trying to find one resource and there is no mapping

0.2.10 (2015-06-12)

  • fix: make it eve 0.6 compatible

0.2.9 (2015-05-11)

  • fix: stop converting null values to datetime

0.2.7 (2015-04-16)

  • feat: allow delete by query

0.2.6 (2015-02-10)

  • fix a bug when getting cursor count

0.2.5 (2015-02-09)

  • add index param to put_mapping method

0.2.4 (2014-12-26)

  • add build_query_string method

0.2.3 (2014-12-08)

  • fix serializer on python 2.7 (by Jonathan Dray)

0.2.2 (2014-12-02)

  • make use of score sort if there is a query defined

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

Eve-Elastic-0.2.21.tar.gz (47.0 kB view details)

Uploaded Source

Built Distribution

Eve_Elastic-0.2.21-py3-none-any.whl (36.0 kB view details)

Uploaded Python 3

File details

Details for the file Eve-Elastic-0.2.21.tar.gz.

File metadata

File hashes

Hashes for Eve-Elastic-0.2.21.tar.gz
Algorithm Hash digest
SHA256 1508a4f31042b105ed3d54ba1d924485b7a17374e522077f419d62c2dfa53730
MD5 6350ce90659ceb08b32a01a27de8d3cb
BLAKE2b-256 6d68e24da142f81a5100b512aac9dcc9d1e527a049458e9939d449e68d867469

See more details on using hashes here.

File details

Details for the file Eve_Elastic-0.2.21-py3-none-any.whl.

File metadata

File hashes

Hashes for Eve_Elastic-0.2.21-py3-none-any.whl
Algorithm Hash digest
SHA256 0661552ed8506f32fc5cdd2c790a4f85c664322c5b72a66eceff0a04241ac915
MD5 19ae5303af4dc414592ffab0b82bbb23
BLAKE2b-256 c3340281864500958c2206eb2ced3e05423c548ccd3edd507559b27e8dc6569c

See more details on using hashes here.

Supported by

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