Open archatas opened 6 years ago
@archatas:
Briefly covered here.
You basically override ELASTICSEARCH_INDEX_NAMES
setting for your environments. Prefixing works fine for me.
dev
ELASTICSEARCH_INDEX_NAMES = {
'search_indexes.documents.address': 'address',
'search_indexes.documents.author': 'author',
'search_indexes.documents.book': 'book',
'search_indexes.documents.city': 'city',
'search_indexes.documents.publisher': 'publisher',
}
prod
ELASTICSEARCH_INDEX_NAMES = {
'search_indexes.documents.address': 'prod_address',
'search_indexes.documents.author': 'prod_author',
'search_indexes.documents.book': 'prod_book',
'search_indexes.documents.city': 'prod_city',
'search_indexes.documents.publisher': 'prod_publisher',
}
Does the command to rebuild index work well in a case of multiple websites indexed with different index prefixes? For example, I might want to rebuild index for example.com. but not for example.org, where these are different Django projects deployed on the same server.
If I run
python manage.py search_index --rebuild
on one website, will it keep the indexes from another website?
It will remove only indexes listed in the ELASTICSEARCH_INDEX_NAMES
. It's also a good way of separating your test environment from dev (or any other).
Is possible to have more elasticsearch servers in conf?
Can you please update the README explaining how to set up several websites using ElasticSearch so that the indexes don't clash (or should I add website-related prefixes to the documents myself)?