From cc299d8873f1dc02e99d4fffee5b670d4c00fd15 Mon Sep 17 00:00:00 2001 From: Karl Hobley Date: Thu, 1 Dec 2016 11:08:48 +0000 Subject: [PATCH] Added example to #3036 upgrade consideration --- docs/releases/1.8.rst | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/docs/releases/1.8.rst b/docs/releases/1.8.rst index aef724338..d3f0a98b3 100644 --- a/docs/releases/1.8.rst +++ b/docs/releases/1.8.rst @@ -148,3 +148,33 @@ Extra options for the Elasticsearch constructor should be now defined with the n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ For the Elasticsearch backend, all extra keys defined in ``WAGTAILSEARCH_BACKENDS`` are passed directly to the Elasticsearch constructor. All these keys now should be moved inside the new ``OPTIONS`` dictionary. The old behaviour is still supported, but deprecated. + +For example, the following configuration changes the connection class that the Elasticsearch connector_ uses: + +.. code-block:: python + + from elasticsearch import RequestsHttpConnection + + WAGTAILSEARCH_BACKENDS = { + 'default': { + 'BACKEND': 'wagtail.wagtailsearch.backends.elasticsearch', + 'connection_class': RequestsHttpConnection, + } + } + +As ``connection_class`` needs to be passed through to the Elasticsearch connector_, it should be moved to the new ``OPTIONS`` dictionary: + +.. code-block:: python + + from elasticsearch import RequestsHttpConnection + + WAGTAILSEARCH_BACKENDS = { + 'default': { + 'BACKEND': 'wagtail.wagtailsearch.backends.elasticsearch', + 'OPTIONS': { + 'connection_class': RequestsHttpConnection, + } + } + } + +.. _connector: https://elasticsearch-py.readthedocs.io/en/master/api.html#elasticsearch