Index and search records using ElasticSearch.
Project description
Kinto ElasticSearch
###################
.. image:: https://img.shields.io/travis/Kinto/kinto-elasticsearch.svg
:target: https://travis-ci.org/Kinto/kinto-elasticsearch
.. image:: https://img.shields.io/pypi/v/kinto-elasticsearch.svg
:target: https://pypi.python.org/pypi/kinto-elasticsearch
.. image:: https://coveralls.io/repos/Kinto/kinto-elasticsearch/badge.svg?branch=master
:target: https://coveralls.io/r/Kinto/kinto-elasticsearch
**kinto-elasticsearch** forwards the records to ElasticSearch and provides a ``/search``
endpoint to query the indexed data.
Install
=======
::
pip install kinto-elasticsearch
Setup
=====
In the `Kinto <http://kinto.readthedocs.io/>`_ settings:
.. code-block :: ini
kinto.includes = kinto_elasticsearch
kinto.elasticsearch.hosts = localhost:9200
Run ElasticSearch
=================
Running a local install of *ElasticSearch* on ``localhost:9200`` with Docker is pretty straightforward:
::
sudo docker run -p 9200:9200 elasticsearch
It is also be installed manually on Ubuntu with:
::
sudo apt-get install elasticsearch
And more information is available in the `official docs <https://www.elastic.co/downloads/elasticsearch>`_.
Usage
=====
Create a new record:
::
$ echo '{"data": {"note": "kinto"}}' | http POST http://localhost:8888/v1/buckets/example/collections/notes/records --auth token:alice-token --verbose
It should now be possible to search for it:
::
$ http POST http://localhost:8888/v1/buckets/default/collections/assets/search --auth token:alice-token --verbose
.. code-block:: http
:emphasize-lines: 20-24
HTTP/1.1 200 OK
Access-Control-Expose-Headers: Retry-After, Content-Length, Alert, Backoff
Content-Length: 333
Content-Type: application/json; charset=UTF-8
Date: Wed, 20 Jan 2016 12:02:05 GMT
Server: waitress
{
"_shards": {
"failed": 0,
"successful": 5,
"total": 5
},
"hits": {
"hits": [
{
"_id": "453ff779-e967-4b08-99b9-5c16af865a67",
"_index": "example-assets",
"_score": 1.0,
"_source": {
"id": "453ff779-e967-4b08-99b9-5c16af865a67",
"last_modified": 1453291301729,
"note": "kinto"
},
"_type": "example-assets"
}
],
"max_score": 1.0,
"total": 1
},
"timed_out": false,
"took": 20
}
Running the tests
=================
::
$ make tests
Changelog
=========
0.0.1 (2017-05-22)
------------------
- Import code from `Kinto official tutorial <http://kinto.readthedocs.io/en/stable/tutorials/write-plugin.html>`_
###################
.. image:: https://img.shields.io/travis/Kinto/kinto-elasticsearch.svg
:target: https://travis-ci.org/Kinto/kinto-elasticsearch
.. image:: https://img.shields.io/pypi/v/kinto-elasticsearch.svg
:target: https://pypi.python.org/pypi/kinto-elasticsearch
.. image:: https://coveralls.io/repos/Kinto/kinto-elasticsearch/badge.svg?branch=master
:target: https://coveralls.io/r/Kinto/kinto-elasticsearch
**kinto-elasticsearch** forwards the records to ElasticSearch and provides a ``/search``
endpoint to query the indexed data.
Install
=======
::
pip install kinto-elasticsearch
Setup
=====
In the `Kinto <http://kinto.readthedocs.io/>`_ settings:
.. code-block :: ini
kinto.includes = kinto_elasticsearch
kinto.elasticsearch.hosts = localhost:9200
Run ElasticSearch
=================
Running a local install of *ElasticSearch* on ``localhost:9200`` with Docker is pretty straightforward:
::
sudo docker run -p 9200:9200 elasticsearch
It is also be installed manually on Ubuntu with:
::
sudo apt-get install elasticsearch
And more information is available in the `official docs <https://www.elastic.co/downloads/elasticsearch>`_.
Usage
=====
Create a new record:
::
$ echo '{"data": {"note": "kinto"}}' | http POST http://localhost:8888/v1/buckets/example/collections/notes/records --auth token:alice-token --verbose
It should now be possible to search for it:
::
$ http POST http://localhost:8888/v1/buckets/default/collections/assets/search --auth token:alice-token --verbose
.. code-block:: http
:emphasize-lines: 20-24
HTTP/1.1 200 OK
Access-Control-Expose-Headers: Retry-After, Content-Length, Alert, Backoff
Content-Length: 333
Content-Type: application/json; charset=UTF-8
Date: Wed, 20 Jan 2016 12:02:05 GMT
Server: waitress
{
"_shards": {
"failed": 0,
"successful": 5,
"total": 5
},
"hits": {
"hits": [
{
"_id": "453ff779-e967-4b08-99b9-5c16af865a67",
"_index": "example-assets",
"_score": 1.0,
"_source": {
"id": "453ff779-e967-4b08-99b9-5c16af865a67",
"last_modified": 1453291301729,
"note": "kinto"
},
"_type": "example-assets"
}
],
"max_score": 1.0,
"total": 1
},
"timed_out": false,
"took": 20
}
Running the tests
=================
::
$ make tests
Changelog
=========
0.0.1 (2017-05-22)
------------------
- Import code from `Kinto official tutorial <http://kinto.readthedocs.io/en/stable/tutorials/write-plugin.html>`_
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for kinto-elasticsearch-0.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5a8e2fbf78a0dcd548bfa27628e4cbbf07a3d1b0aaa614c10ad52a0e34925851 |
|
MD5 | ddd6800321eb742f0d9213f7cb9da21d |
|
BLAKE2b-256 | b9638eafbf57711248575d32566ac140507c8081816feca507b9e29ee5f869bf |
Close
Hashes for kinto_elasticsearch-0.0.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 41b5ea8ac435d652c846c9d401bb475c1c58a9eb25dce05c44b7dfc911b7d421 |
|
MD5 | e249be842b8a7b02e478ae42c580bbd9 |
|
BLAKE2b-256 | 9b3c1e0c1e0110fb84807213663bd9013827cafbf6395d6cf9d574f749d419e2 |