Django REST Search¶
Django REST Search provides a set of classes to facilitate the integration of ElasticSearch [1] into applications powered by the Django REST Framework [2].
Installation¶
The easiest way to install Django REST Search is using pip.
pip install djangorestsearch
Add ‘rest_search’ to your INSTALLED_APPS setting.
INSTALLED_APPS = [
...
'rest_search',
]
Add the middleware to flush ElasticSearch updates to a celery task.
MIDDLEWARE = [
...
'rest_search.middleware.FlushUpdatesMiddleware',
]
Configure your ElasticSearch connection.
REST_SEARCH_CONNECTIONS = {
'default': {
'HOST': 'es.example.com',
}
}
If you wish, you can customise the settings used when creating an index.
REST_SEARCH_INDEX_SETTINGS = {
'analysis': {
'analyzer': {
'default': {
'tokenizer': 'standard',
'filter': [
'lowercase',
'asciifolding',
]
}
}
}
}