Black Friday 25% off Shop the sale
Tutorials

XenForo Elasticsearch: When to Use It and How to Set It Up

XenForo Elasticsearch can help a large forum with slow or weak search. Learn the signs to switch, the setup steps and how to go back if needed.

D.C Style · 6 min read
Share on X
A magnifying glass over stacked post cards next to a small server.
On this page

XenForo Elasticsearch can help if your forum is large and search is slow or weak. It is not a core setting, though. It comes from a separate add-on called XenForo Enhanced Search (XFES), which replaces the built-in search and needs a server that runs Elasticsearch. This guide shows how to decide, how to set it up, and how to back out.

Do you need Elasticsearch? A quick answer

Most small and mid-size forums do not. The built-in search works fine for them. Consider the switch if search is slow at busy hours, results feel poor, or search load is hurting the rest of the site.

You also need a host that allows it. Most shared hosts don't offer Elasticsearch, so ask yours before you plan anything. If you only have shared hosting, skip to the last section for other options.

Note:
This guide covers XenForo 2.3 requirements only. A minimum Elasticsearch version for XenForo 2.2 is not confirmed here. Check the XenForo Enhanced Search manual for your version.

What XenForo's built-in MySQL search does well

XenForo ships with a search that runs on your MySQL database. MySQL is the database your forum already uses for everything else. That means there is nothing extra to install, run or pay for.

For a forum with a modest number of posts, it is simple and reliable. It also keeps your setup easy to move and back up.

Recent changes help the built-in search

XenForo's notes for 2.3.14 cover the built-in search. Logged-out users can run at most 4 searches at once across the site. Searches with no keywords, like "Recent content" and "Find all content by user", now make better use of existing MySQL table indexes.

The 2.3.14 performance post is a pre-release announcement. Check the final release notes for your version before you rely on these details.

Signs your search has outgrown MySQL

Look for these signs before you spend time on a new server:

  • Members keep reporting that xenforo search slow complaints are real, even when the rest of the site is fast.
  • Search pages take a long time to load at busy hours.
  • Members say they cannot find posts they know exist.
  • Your server load rises when many people search at once.

Check guest search first

If bots or logged-out visitors are hammering search, Elasticsearch may not be the first fix. XenForo says the guest-search limit came from volume on XenForo Cloud, where about 40 million guest search requests a week were saturating PHP workers.

From 2.3.14, new installs have guest searching turned off by default through permissions. Existing sites are not changed. XenForo still recommends turning off guest search if you don't need it.

To do that, turn off the search permission for guests in your user group permissions. It costs nothing, and it is a sensible first step among your xenforo search settings.

What you need before you switch: server, version and backup

Gather three things first.

  1. A server that can run Elasticsearch. Ask your host. For XenForo 2.3, XenForo's release posts say Enhanced Search needs at least Elasticsearch 7.2. See the 2.3.11 release post and the 2.3.0 beta 5 post.
  2. The XFES add-on. XenForo sells it separately.
  3. A full backup. Back up your database and files before you install anything.
Note:
The manual page says Elasticsearch 2.0 or newer. That looks outdated, so use the 2.3 figure above. No upper version limit and no OpenSearch support are confirmed, so don't assume either works.

This is how to enable elasticsearch xenforo sites can use. XFES replaces the built-in search system, so follow the steps in order.

  1. Install the XFES add-on the normal way, through the Add-ons page in the Admin CP.
  2. Go to Setup > Enhanced Search.
  3. Enter your Elasticsearch server details.
  4. Choose your index options (see below).
  5. Rebuild the search index so older content can be found.

The three index options

  • Stop words keep some common words out of the index. This can make the index smaller.
  • Word stemming treats forms of a word as the same, so "tests" matches "test".
  • Accent removal and character simplification lets "esta" match "está".

Rebuild the index

After the index is created, you must rebuild it so existing content shows up in search. You must rebuild it again if you change the index configuration later. The manual excerpt doesn't give the exact menu path, so look in the rebuild tools in your Admin CP. A large forum can take a while, so run it at a quiet hour.

Check that search works and roll back if it doesn't

Test before you tell your members.

  1. Search for a word you know is in an old post.
  2. Search for a word from a very recent post.
  3. Try a different form of a word, like a plural, if you turned on stemming.
  4. Watch your server load while a few searches run.

If results are missing, rebuild the index again first. Missing results often mean the rebuild did not finish.

Going back

There are no confirmed official rollback steps. The manual's wording suggests you may be able to disable or uninstall the add-on to return to the built-in MySQL search, but that is not confirmed. Treat your backup as the real way back, and restore it if something goes badly wrong.

While you are working on search, you might also look at the free AI Disclosure Label. It adds AI-assisted filters to the native Search threads form. The add-on itself needs XenForo 2.2 or later.

Other speed wins to try first or alongside it

Elasticsearch only helps search. If the whole site feels slow, try these too:

  • Turn off guest search if you don't need it (see above).
  • If you plan to change servers, make sure the new host can run Elasticsearch before you move.

XenForo 2.3.14 also cuts load in other ways, according to its pre-release post: a shared cached What's New page for guests, attachments cached for up to an hour, and better handling of image proxy and oEmbed requests.

What to do next

Ask your host which Elasticsearch version it offers. Turn off guest search if you don't need it. If you still need more, take a backup, install XFES, and rebuild the index. Browse more guides in our Tutorials section.

Sources