Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/chiangf/Flask-Elasticsearch
Flask extension that provides simple integration with Elasticsearch
https://github.com/chiangf/Flask-Elasticsearch
Last synced: 11 days ago
JSON representation
Flask extension that provides simple integration with Elasticsearch
- Host: GitHub
- URL: https://github.com/chiangf/Flask-Elasticsearch
- Owner: chiangf
- License: mit
- Created: 2015-04-29T00:32:41.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-07-06T13:06:56.000Z (over 7 years ago)
- Last Synced: 2024-09-16T01:39:16.921Z (about 2 months ago)
- Language: Python
- Homepage:
- Size: 10.7 KB
- Stars: 134
- Watchers: 6
- Forks: 22
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Flask-Elasticsearch
This is a Flask extension that provides simple integration with Elasticsearch.
## Usage
In order to install:
```
pip install Flask-Elasticsearch
```In your main app file:
```
from flask import Flask
from flask.ext.elasticsearch import FlaskElasticsearchapp = Flask(__name__)
es = FlaskElasticsearch(app)
```If you're following the [Application Factories](http://flask.pocoo.org/docs/0.10/patterns/appfactories/) pattern:
```
from flask import Flask
from flask.ext.elasticsearch import FlaskElasticsearches = FlaskElasticsearch()
app = Flask(__name__)
es.init_app(app)
```Now that you have the ```es``` object, you can perform searches. To read more about how to do that, see [Python Elasticsearch Client](https://elasticsearch-py.readthedocs.org).
## Customizing Properties
In order to customize the host, add the following into your app.config (see [Configuration Handling](http://flask.pocoo.org/docs/0.10/config/) for more details):
```
ELASTICSEARCH_HOST = "10.10.10.13:9200" # default is "localhost:9200"
```If you need to use HTTP Authentication for the Elasticsearch connection, add the following to your app.config:
```
ELASTICSEARCH_HTTP_AUTH = ""
```If ```ELASTICSEARCH_HTTP_AUTH``` is not set, the Elasticsearch connection will simply not use authentication.