Manage more than one Elasticsearch or Solr index

76 views December 4, 2018 July 13, 2019 admin 0

In most situations, only one Elasticsearch/Solr index will be required to index and search a WordPress site.

But in some occasions, two or even more Elasticsearch/Solr indexes can be handy. Not only can you create several Elasticsearch indexes, or several Solr indexes, but you can even mix Elasticsearch and Solr indexes.

Below are listed some use case for which one could need several indexes.

Multi-language

The general description of this use case can be found in the knowledge base article on multi-language search.
Two ore more languages are managed by the WPML or Polylang plugin. Search results will not only display documents from the selected language, but also apply some language-specific rules. This is achieved by indexing documents associated with a language in their own index, configured with a schema containing the language-specific analysers.

 

Concurrent indexing

Let us imagine that, for some reason, one need to reindex completely all the documents. Deleting the index content, then reindex it, can take quite some time with millions of documents.

But a better option is to index a secondary index, while the first index is still serving the search results. At the end of the full indexing, one just have to promote the secondary index as the primary index. Visitors will never be served empty results.

Using several Elasticsearch/Solr indexes

Indexing secondary Elasticsearch/Solr index

 

Live index schema update

If an index schema has to be changed, it is inevitable that a full reindexing must occur. But during the reindexing, results would be wrong. Unless a secondary index is created, setup with the new schema, and indexed fully.

 

Index upgrade or migration

Sometimes, an index must be upgraded to a later version. Or cloned to another hosted service. This is usually a stress, but not with WPSOLR.

Creating a new index, with the latest version, or located at the new hosted service, will allow (after reindexing) to test quietly the new  search results. If errors are detected, the search can quickly be setup back to the primary (untouched) index.

Was this helpful?

Join Our weekly Newsletter

Receive our latest news once a week, each Thursday afternoon.
Your email is kept 100% private, and you will not receive other stuff in your mailbox.

We keep your data private and share your data only with third parties that make this service possible. Read our Privacy Policy.