Configuration & operations
Switching Koha from Zebra to Elasticsearch
The Koha side of the switch is four steps: point koha-conf.xml at the server, change one system preference, build the indexes, and start the indexer daemon that keeps them current.
By Babar Junaid
Updated 2026-08-12 · Tested against Koha 26.05
Once Elasticsearch itself is running, the Koha side is four steps: put the server address in koha-conf.xml, set the SearchEngine system preference to Elasticsearch, build the indexes with koha-elasticsearch --rebuild, and start koha-es-indexer so they stay current. Zebra keeps working the whole time, which is what makes this reversible.
Do the first build outside opening hours
- Check free disk before you start — the index is roughly comparable in size to the data it covers.
- Elasticsearch wants memory of its own. Sharing a small server with the database and Koha is where most bad first experiences come from.
- Have a backup you have actually restored, as with any change of this size.
First: which Elasticsearch
Koha talks to Elasticsearch through a Perl client, and each Koha release supports a particular range of server versions. That range moves, so check your own release's notes and the community wiki before installing a server rather than taking a version number from any guide, including this one. An unsupported major version does not fail politely — it connects, indexes, and returns wrong or empty results.
Install the server on its own host if you can. It is a separate service with its own memory appetite and its own upgrade cycle, and putting it beside the database on a small machine is the usual reason a switch to Elasticsearch makes a catalog slower rather than faster.
Step 1Point the instance at the server
Every instance already has an <elasticsearch> block in its configuration, filled in when the instance was created:
<elasticsearch> <server>localhost:9200</server> <index_name>koha_library</index_name> <cxn_pool>Static</cxn_pool> </elasticsearch>Two things to get right. <server> may be repeated, once per node in a cluster. <index_name> must be unique across everything sharing that Elasticsearch — Koha appends _biblios and _authorities to it, so two instances with the same name silently share one index and each sees the other's records. On a server with several libraries this is the mistake to check twice.
For an instance that does not exist yet, koha-create takes --elasticsearch-server and writes the block for you.
Step 2Switch the system preference
- 1In the staff interface, go to Administration → Global system preferences and search for SearchEngine.
- 2Change it from
ZebratoElasticsearchand save.
This is the switch itself, and it is instant — which is why the index has to be built next, not first. Searching before the build finishes returns whatever is in the index so far, which is usually nothing.
Step 3Build the indexes
$ sudo koha-elasticsearch --rebuild -d -v library Indexing biblios218430 records indexedIndexing authorities41207 records indexed-d deletes the existing index before rebuilding, which is what you want on a first run and after any mapping change. -v makes it report progress. On a large catalog -p runs several processes in parallel — useful, and worth introducing carefully rather than starting at the maximum your CPU count allows.
To rebuild only one side of it later, -b is biblios and -a is authorities.
Step 4Start the indexer daemon
This is the step people miss, and the symptom is delayed and confusing: searching works perfectly on the day of the switch, and weeks later new records cannot be found. Nothing keeps the index current unless the indexer is running.
$ sudo koha-es-indexer --start library$ sudo koha-es-indexer --status library ES indexer running for libraryThen confirm it survives a reboot, because a service started by hand does not: reboot a test server, or at minimum re-check the status after systemctl restart koha-common.
Check it actually worked
- 1Search the OPAC for a title you know is in the catalog. It should be found.
- 2Edit a record's title slightly, save, wait a few seconds, and search for the new wording. If the old wording still matches and the new one does not, the indexer is not running.
- 3Search for something with a diacritic, and something in a non-Latin script if your catalog has one. Analyzer problems show up here rather than on English titles.
Going back to Zebra
Set SearchEngine back to Zebra. Nothing else has to be undone — Zebra's index was never switched off, and the records themselves are in the database, untouched by any of this. If Zebra's index has gone stale in the meantime, rebuild it and you are exactly where you started.
That is the honest reason to try it on a copy first: the switch back is cheap, and the migration of expectations is not.
What you are actually getting
Elasticsearch is not simply a faster Zebra. It changes relevance ranking, facets, and how much control you have over which MARC fields are searchable and how they are weighted — that mapping is editable in the staff interface, which is the real reason larger libraries move. It is also a second daemon to run, monitor, patch and back up.
Whether that trade is right for a given library is a decision rather than a procedure — Zebra or Elasticsearch argues it with the costs stated. This page is only what to do once the decision is made.
One consequence worth knowing before you commit: with Elasticsearch, a search failure is now a possible outage. If the Elasticsearch host is unreachable, searching stops, even though Koha and the database are perfectly healthy. Monitor it like a component of the catalog, because after this change that is what it is.
Would rather not do this yourself? We do it as a service — and if you would rather it were already done, it is on Koha Cloud before you log in.
Related
More on configuration & operations
Answers to the questions that usually arrive with this one.
HTTPS for Koha's OPAC and staff interface with Let's Encrypt
Both Koha sites need a certificate, not just the public one. Here is the whole procedure for an existing instance, and the two system preferences that have to be updated or Koha keeps emailing people http:// links.
Koha returns 502 or 503 after enabling Plack
Apache is proxying to Plack and cannot reach it. Nearly always two missing Apache modules — koha-plack tells you which, in a warning that scrolls past.
Koha internal server error: finding the line that caused it
A 500 page is Koha telling you nothing on purpose. The real message is in that instance's error log — here is which file to read, and the two causes that produce most of them.
Rebuilding the Zebra index when Koha search results go stale
A record you can open by its number but cannot find by searching means the index is behind, not that the record is missing. Here is how to rebuild it properly.

