Skip to main content

Elasticsearch data layer for eve rest framework

Project description

Eve-Elastic
===========

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

Eve-Elastic is `elasticsearch <http://www.elasticsearch.org>`_ data layer for `eve REST framework <http://python-eve.org>`_.

Features
--------

- fulltext search
- filtering via elasticsearch filter dsl
- facets support
- elasticsearch mapping generator for schema

License
-------
Eve-Elastic is `GPLv3 <http://www.gnu.org/licenses/gpl-3.0.txt>`_ licensed.

Install
-------

.. code-block:: bash

$ pip install Eve-Elastic

Usage
-----
Set elastic as your eve data layer.

.. code-block:: python

import eve
form 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 <http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-term-filter.html>`_ filter.

On top of this, there is a predefined `query_string <http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html>`_ query which does fulltext search.

.. code-block:: console

$ curl http://localhost:5000/items?q=foo&df=name

- ``q`` - query (default: ``*``)
- ``df`` - default field (default: ``_all``)

Filter DSL
~~~~~~~~~~
For more sophisticated filtering, you can use ``filter`` query param which will be used as filter for the query, using elastic `filter dsl <http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-filters.html>`_.

Facets
------
To add a facets support for specific resource, add ``facets`` into its ``datasource``:

.. code-block:: python

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 <http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-facets.html>`_.


.. :changelog:

Changelog
---------

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

Uploaded Source

File details

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

File metadata

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

File hashes

Hashes for Eve-Elastic-0.1.3.tar.gz
Algorithm Hash digest
SHA256 42ba6a3c9727e5fabc34734265c20c14dc5104be25c0a2f182c1191ec222177a
MD5 f5c3da62aa272eb68df0f87d3114449a
BLAKE2b-256 34941ef8d01e66b758d315b3673d7c1cd4cb8942064678e1d2d4bcdf627afe4f

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