Django REST Search¶

Django REST Search provides a set of classes to facilitate the integration of OpenSearch [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 OpenSearch updates to a celery task.

MIDDLEWARE = [
    ...
    'rest_search.middleware.FlushUpdatesMiddleware',
]

Configure your OpenSearch 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',
                ]
            }
        }
    }
}

Contents¶

  • Indexers
    • Declaring indexers
    • Options
    • Index updates
  • Celery Tasks
[1]

https://opensearch.org/

[2]

http://www.django-rest-framework.org/

django-rest-search

Navigation

  • Indexers
  • Celery Tasks

Related Topics

  • Documentation overview
    • Next: Indexers
©2016-2021, Wemap SAS. | Powered by Sphinx 9.0.4 & Alabaster 1.0.0 | Page source