Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/superdesk/eve-elastic
Elasticsearch data layer for eve framework
https://github.com/superdesk/eve-elastic
Last synced: about 2 months ago
JSON representation
Elasticsearch data layer for eve framework
- Host: GitHub
- URL: https://github.com/superdesk/eve-elastic
- Owner: superdesk
- License: gpl-3.0
- Created: 2013-11-18T10:39:19.000Z (almost 11 years ago)
- Default Branch: elastic7
- Last Pushed: 2024-03-20T14:10:13.000Z (6 months ago)
- Last Synced: 2024-07-26T14:01:48.289Z (2 months ago)
- Language: Python
- Size: 389 KB
- Stars: 69
- Watchers: 11
- Forks: 21
- Open Issues: 3
-
Metadata Files:
- Readme: README.rst
- Changelog: CHANGELOG.rst
- License: LICENSE
- Authors: AUTHORS.md
Awesome Lists containing this project
README
Eve-Elastic
===========.. image:: https://travis-ci.org/petrjasek/eve-elastic.png?branch=elastic7
:target: https://travis-ci.org/petrjasek/eve-elasticEve-Elastic is `elastic `_ data layer for `eve REST framework `_.
Features
--------- fulltext search
- filtering via elasticsearch filter dsl
- facets support
- aggregations support
- elasticsearch mapping generator for schemaLicense
-------
Eve-Elastic is `GPLv3 `_ licensed.Supported elastic versions
--------------------------It supports elastic ``7`` versions.
Install
-------.. code-block:: bash
$ pip install Eve-Elastic
Usage
-----
Set elastic as your eve data layer... code-block:: python
import eve
from eve_elastic import Elasticapp = eve.Eve(data=Elastic)
app.run()Config
------
There are 2 options for Eve-Elastic taken from ``app.config``:- ``ELASTICSEARCH_URL`` (default: ``'http://localhost:9200/'``) - this can be either single url or list of urls
- ``ELASTICSEARCH_INDEX`` - (default: ``'eve'``)
- ``ELASTICSEARCH_INDEXES`` - (default: ``{}``) - ``resource`` to ``index`` mapping
- ``ELASTICSEARCH_FORCE_REFRESH`` - (default: ``True``) - force index refresh after every modification
- ``ELASTICSEARCH_AUTO_AGGREGATIONS`` - (default: ``True``) - return aggregates on every search if configured for resourceQuery 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.
.. code-block:: bash
$ 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``:.. 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 `_.