Elasticsearch integration for Bottle
Project description
Bottle Elasticsearch
==============
.. image:: https://travis-ci.org/bsao/bottle-elastic.svg?branch=master
:target: https://travis-ci.org/bsao/bottle-elastic
This bottle-elastic plugin integrates Elasticsearch with your Bottle
application. It injects a Elastic connection in your route and handle the
session cycle.
Support elasticsearch 2.x
Usage Example:
.. code-block:: python
from bottle import Bottle
from bottle_elastic import ElasticPlugin
from datetime import datetime
app = Bottle()
plugin = ElasticPlugin(hosts=["localhost:9200"])
app.install(plugin)
@app.route('/', method='GET')
def index(elastic):
# elastic search operation
return "ok"
@app.route('/create/', method='POST')
def create(elastic):
doc = {
'name': 'bsao',
'text': 'Elasticsearch: cool.',
'timestamp': datetime.now(),
}
response = elastic.index(index="test-index", doc_type='tweet', id=1, body=doc)
return response
==============
.. image:: https://travis-ci.org/bsao/bottle-elastic.svg?branch=master
:target: https://travis-ci.org/bsao/bottle-elastic
This bottle-elastic plugin integrates Elasticsearch with your Bottle
application. It injects a Elastic connection in your route and handle the
session cycle.
Support elasticsearch 2.x
Usage Example:
.. code-block:: python
from bottle import Bottle
from bottle_elastic import ElasticPlugin
from datetime import datetime
app = Bottle()
plugin = ElasticPlugin(hosts=["localhost:9200"])
app.install(plugin)
@app.route('/', method='GET')
def index(elastic):
# elastic search operation
return "ok"
@app.route('/create/', method='POST')
def create(elastic):
doc = {
'name': 'bsao',
'text': 'Elasticsearch: cool.',
'timestamp': datetime.now(),
}
response = elastic.index(index="test-index", doc_type='tweet', id=1, body=doc)
return response
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
bottle-elastic-0.2.1.tar.gz
(2.7 kB
view details)
File details
Details for the file bottle-elastic-0.2.1.tar.gz
.
File metadata
- Download URL: bottle-elastic-0.2.1.tar.gz
- Upload date:
- Size: 2.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 36fd5f9f22c5fd62ddf415074e5960316917b37ab8b00f33c270177dc94721f6 |
|
MD5 | 4e991956c32eb422be2d57de8711be91 |
|
BLAKE2b-256 | 283309b74af9c988efcfc977f311bb51d641816022870fa1190e5adcebb0f512 |