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

  • 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.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

This version

0.1.6

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.1.6.tar.gz (41.8 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: Eve-Elastic-0.1.6.tar.gz
  • Upload date:
  • Size: 41.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for Eve-Elastic-0.1.6.tar.gz
Algorithm Hash digest
SHA256 df52f3dfffe51fb684ed01024edb6f5213442d937a67bb7beba4facb86089b69
MD5 c72142b1042ed723f69d8a7af4b51a8b
BLAKE2b-256 f031c43885285ab5fbab970264bc1152bacd11d890fabf83d057e6ef6636bb3d

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