The Divio Cloud offers you search (Elastic search version 2.3) as a service, which allows you to integrate advanced search features directly into your project without having to manage complex search clusters.
We recommend using Haystack with Elastic search; it's a Django application that provides a clean and usable interface to Elastic search.
How to enable Elastic search
In your project's Subscription, add as many Elastic search instances as you think you will need. One you have applied the new subscription, we will provision it on your Cloud project.
This will include applying a
DEFAULT_HAYSTACK_URL environment variable, that takes the form:
There is also native support for AWS ElasticSearch style connections:
Other options are also available, so if you have special requirements please contact our support.
Set up a cron job, for example:
python manage.py rebuild_index --noinput
ALDRYN_HAYSTACK_DEBUG environment variable to
True to get detailed logs from Haystack.
Local environment set-up
For local development add an ElasticSearch service to
and add a link to it from the web service:
Then add the environment variable to configure the connection (on the default aldryn setup: add to
Test the connection:
docker-compose run --rm web python manage.py shell
>>> from haystack.query import SearchQuerySet
There won't be any results yet, since nothing has so far been indexed. However you will get an error if the connection does not work.
For further information
To learn more about how to setup your project, please see the Aldryn Haystack GitHub Repository.