Key Takeaways
- Elasticsearch improves WordPress search speed and relevance.
- Cloudways offers a simple, pre-installed Elasticsearch setup.
- Manual setup involves installing Elasticsearch and connecting with ElasticPress.
- ElasticPress plugin is crucial for WordPress-Elasticsearch integration.
- Indexing content is necessary for Elasticsearch to work.
Ever used a search bar on a WordPress site and felt frustrated by how slow or unhelpful the results were?
You’re not alone.
WordPress’s default search is often one of the first things to fall short, especially as your site grows and you add more content, products, or pages.
That’s where Elasticsearch can make a real difference. It’s built to handle large volumes of data and return relevant results quickly. Instead of relying on basic database queries, Elasticsearch works like a dedicated search engine that helps users find what they’re looking for faster and more accurately.
In this guide, we’ll walk through two ways to integrate Elasticsearch with your WordPress site. If you’re hosting your app on Cloudways, the process is pretty straightforward, and we’ll cover that first.
If you’re hosting elsewhere, we’ll go through the full manual setup — from installing Elasticsearch to connecting it with WordPress using ElasticPress.
By the end, you’ll have a faster, more reliable search experience running on your site.
What Is Elasticsearch?
Elasticsearch was released in 2010 and is used to search queries faster in large databases. Elasticsearch is extremely fast when dealing with raw data and is a highly scalable search engine, unlike conventional searches. Elasticsearch has an extensive API that can be integrated into any web application, including WordPress for big data discovery.
Elasticsearch in WordPress addresses the poor and slow performance of its default searching capabilities. It may look OK on a site with small databases, but it gets painful for the visitors trying to find their product from 50 different categories. Elasticsearch offers real-time index updates that instantaneously add a new document to the index.
Why Use Elasticsearch?
Large websites with directories and archives on various categories can utilize Elasticsearch. Online stores with thousands of products can reduce the search time using Elasticsearch in WordPress. This also improves the user experience as it allows customers to further narrow down their search queries to find the desired product faster.
Another amazing feature of Elasticsearch is its ability to support real-time application monitoring. This involves indexing search data and creating logs for future analysis. It is a useful feature for e-commerce stores that wish to see trends in customers’ buying behavior and set their marketing strategies accordingly.
Cloudways Provides Elasticsearch FREE on 1-Click.
Explore all features today by launching our WordPress server
How to Configure Elasticsearch on WordPress on Cloudways (Easy Approach)
Configuring Elasticsearch on a WordPress app hosted on Cloudways is super simple compared to manually doing it (you’ll get what I mean when you get to the manual Elasticsearch setup). Launching a server with a WordPress app takes no longer than 5-6 minutes and configuring Elasticsearch will take you another 10.
Let’s get started…
Prerequisites
Before configuring Elasticsearch on WordPress, ensure you meet the following requirements:
- You have a Cloudways account.
- You are comfortable editing WordPress files.
- You are familiar with WP-CLI.
Step 1: Deploy a WordPress Application on Cloudways
Before you can enable Elasticsearch, you need a Cloudways server with a WordPress application already deployed. If you already have one, you can skip this step.
- Log in to your Cloudways account and add a server if you don’t have one already.

- Click on “+ Add Server“.

- Select your Application, we’ll go with WordPress.

- Choose your application stack, Hybrid or Lightning.

- Choose your preferred Cloud Provider (e.g., DigitalOcean, AWS, Google Cloud, Linode, Vultr).

- Select your desired Server Size based on your traffic and resource needs.

- Choose a Location closest to your target audience.

- Preview the spec of your server and click “Launch Now”.

Cloudways will now deploy your server and install the WordPress application. This process usually takes a few minutes.
Alternatively, if you already have a server, you can just create a new app and choose WordPress on which you’ll integrate Elasticsearch in the next steps.

Step 2: Enable Elasticsearch
Once your WordPress application is deployed on a Cloudways server, you can proceed to enable Elasticsearch for that server.
- Go to “Settings & Packages” in Server Management.
- Click “Packages“.
- Enable Elasticsearch by selecting the version. I’ll choose the latest version (8.11).

- This will enable Elasticsearch on your current server.
Note: Cloudways currently supports Elasticsearch 7.17 and 8.11. Older versions like 7.9, have been deprecated as of August 1st, 2023.
Step 3: Install ElasticPress on WordPress
ElasticPress is a WordPress plugin that allows your WordPress website to communicate with Elasticsearch on the server.
Follow the steps below to install ElasticPress:
- Log in to your WordPress dashboard.
- Click Add Plugins.
- Search for “ElasticPress“.
- Click “Install Now“.

- Don’t forget to activate the plugin as well.

Step 4: Configure ElasticPress in wp-config.php
To enable your WordPress site to communicate with Elasticsearch, you need to define the Elasticsearch host and port in your wp-config.php file.
Since Elasticsearch on Cloudways runs on the same server as your WordPress website, you can use the local IP address.
The wp-config.php file is located in the root directory in the public_html directory of your WordPress installation. You can edit it using FileZilla.
I’ll open FileZilla and connect using my FTP credentials—host, username, password, and port. Since I’m using Cloudways, I’ll get my credentials from the Master Credentials tab in my server settings.


Once you have access to your server files, edit your wp-config.php file and add the following line:
/** ElasticPress Host */ define( 'EP_HOST', 'http://127.0.0.1:9200' );

Note: The 127.0.0.1 IP address refers to the local machine, indicating that ElasticPress and Elasticsearch are on the same server. If your Elasticsearch instance were on a different server, you would need to replace 127.0.0.1 with that server’s public IP address or hostname.
- Go back to WordPress Dashboard → ElasticPress and complete step 3 as shown in the screenshot below. Pretty self explanatory.

- Finally click on the Index Your Content button.

- Now, an auto sync process will run. Wait for it to finish.

Step 5: Connect to Your Server and Index Content
Now that you’ve installed and configured ElasticPress, you might be wondering — how does WordPress actually start using Elasticsearch?
Good question.
To make the connection work, you need to send (or “index”) your site’s content — posts, pages, custom post types — into Elasticsearch. This gives ElasticPress something to search through.
To do that, log in to your server via SSH from the Cloudways Platform. Once you’re in, run the indexing command. It tells WordPress to push all your content into Elasticsearch so it can be queried for faster, more accurate results.
This is a one-time setup step (though you can re-index anytime if your content changes a lot).
- Head over to “Servers“.

- Select the server on which you deployed your WordPress application.

- Click “Launch SSH Terminal” or use Putty to connect to your server. I’ll just conveniently launch the SSH terminal from the Cloudways platform.

- Use your Username and Password to log in to your server.

- Inside your terminal window, run the ‘cd applications’ command to access the applications running on this server.
- Then, type ‘ls’ to get the list of applications.

- Depending on your setup, your server may host one or several WordPress applications. To configure a specific application, you’ll first need to navigate to its directory.
- Use the following command to change into the root folder of your app: cd [application-folder-name]

- Make sure you’re inside the correct folder. This is where your WordPress files live.
- Now that you’re in the right directory, it’s time to run the ElasticPress command. For that, you’ll need WP-CLI. Fortunately, on Cloudways, WP-CLI is pre-installed with every WordPress instance.
- To build the initial Elasticsearch indexes, run:
wp elasticpress sync –setup
This command will sync your WordPress content (like posts, pages, and custom fields) with your Elasticsearch server, allowing ElasticPress to start delivering fast and accurate searches.
You’ll see an output like this:

Success, Elasticsearch is successfully implemented and indexed with our WordPress site via ElasticPress.
If you take a look at the screenshot above, it confirms that 2 posts have been successfully pushed from your MySQL database into the Elasticsearch index.
So now, when a user performs a search on our WordPress site, ElasticPress will intercept that search query and send it to Elasticsearch instead of relying on WordPress’s default, less powerful MySQL search.
Manual Elasticsearch Setup for WordPress [Time Consuming]
If you’re not hosting your WordPress site on Cloudways, don’t worry, you can still integrate Elasticsearch. It just takes a few extra steps. Let’s walk through what you’ll need, what we’re doing, and how to get it done.
Prerequisites
Before anything, you’ll need:
- A server or VPS (e.g., DigitalOcean, AWS, Linode, etc.) with SSH access.
- WordPress installed (on the same server or a server that can reach Elasticsearch).
- Root access or sudo privileges to install packages.
- Basic familiarity with terminal commands.
For the sake of simplicity, just to show you how to integrate Elasticsearch in WordPress, here’s my setup:
- A Windows laptop
- XAMPP installed and running (Apache + MySQL + PHP)
- A working local WordPress site inside XAMPP (e.g., http://localhost/wordpress)
Use my setup and follow along the steps mentioned below to configure WordPress Elasticsearch.
Step 1: Install XAMPP (Skip if you already have it)
- Go to https://www.apachefriends.org/index.html
- Download the Windows version of XAMPP
- Install it and launch the XAMPP Control Panel
- Start the following modules:
- Apache
- MySQL
You should see green indicators. That means both services are running.

Step 2: Set Up WordPress in XAMPP
1. Download WordPress

- Download the ZIP file and extract it

2. Move WordPress to XAMPP
- Copy the extracted wordpress folder
- Paste it into this folder: C:\xampp\htdocs
- Rename it if you want (e.g., mywp), but for now, we’ll keep it as wordpress
So the path becomes: C:\xampp\htdocs\wordpress

3. Create a MySQL Database for WordPress
- In your browser, go to: http://localhost/phpmyadmin

- Click the Databases tab
- Under “Create database”, name it something like wordpress_db
- Click Create
You now have a blank database for WordPress to use.

4. Install WordPress
- Go to: http://localhost/wordpress
- Choose your language and click Continue

- Enter your database details:
- Database Name: wordpress_db
- Username: root
- Password: (leave this blank)
- Database Host: localhost
- Table Prefix: wp_ (or anything else)

Click Submit, then Run the Installation.

- Fill in:
- Site Title
- Admin Username
- Password
- Click Install WordPress


Once done, go to http://localhost/wordpress/wp-admin. You should now have a local WordPress site running on XAMPP!

Step 3: Install Elasticsearch on Windows
This step sets up the search engine that WordPress will connect to via the ElasticPress plugin.
1. Download Elasticsearch
- Go to https://www.elastic.co/downloads/elasticsearch
- Download the latest Windows ZIP version

2. Extract the Elasticsearch Folder
- Extract the ZIP file to a folder like C:\elasticsearch
- In my case, as you can see from the screenshot below, I’ve moved the unzipped elasticsearch-9.0.4 folder to my C drive.

3. Temporarily Disable Security
Navigate to the Elasticsearch config directory:
C:\elasticsearch-9.0.4\config
Open the file named elasticsearch.yml in a plain text editor (like Notepad).

Find the line xpack.security.enabled:
Change its value to false.
So, it should look like this: xpack.security.enabled: false

Save the elasticsearch.yml file.
4. Run Elasticsearch
Open a new Command Prompt (as Administrator), navigate to C:\elasticsearch-9.0.4\bin, and run elasticsearch.bat command.
Wait for the “started” message in the Command Prompt.

Now, try http://localhost:9200 in your browser. (Note: Use http, not https, since we disabled security in the earlier step). You should now see the JSON output directly without a login prompt.
You should see JSON output with version info. Example:
{
"name" : "your-machine-name",
"cluster_name" : "elasticsearch",
"version" : {
"number" : "8.x.x",
...
}
}

As we can see in the screenshot above, Elasticsearch is now up and running on your Windows machine.
Step 4: Install ElasticPress Plugin in WordPress
ElasticPress is a plugin that connects WordPress to your Elasticsearch server.
1. Install via Dashboard
- Log in to: http://localhost/wordpress/wp-admin
- Go to Plugins → Add New
- Search for ElasticPress and click Install Now

- Then click Activate
Step 5: Connect ElasticPress to Local Elasticsearch
You now need to tell ElasticPress where to find Elasticsearch.
1. Edit wp-config.php
- Go to: C:\xampp\htdocs\wordpress\wp-config.php
- Add this line before /* That’s all, stop editing! */:
define( 'EP_HOST', 'http://localhost:9200' );

- Save the file.
2. Activate Indexing
- Back in the WordPress dashboard, go to: ElasticPress → Settings

- This will bring you to an initial setup wizard. Step 1 and 2 will be already done at this stage, just select your preferences for step 3 and then finally click on the “Index Your Content” option in step 4.

- Now the plugin will run a quick sync to index your content and connect to Elasticsearch.

At this stage, you’re all done. Let’s test to make sure everything is working properly.
Step 6: Test It Works
- Go to your site’s frontend (http://localhost/wordpress)
- Use the search box to look for posts

- You should notice:
- Faster search performance
- More relevant results
As you can see, I searched for a specific text that was present in the About Us page and because we have elasticsearch implemented on WordPress, our search result showed us exactly that page and that too instantly.
Experience Elasticsearch on WordPress
Our lightening-fast managed WordPress servers make your hosting experience seamless and hassle-free.
Wrapping Up!
Search is one of those features that quietly shapes how people experience your site. If visitors can’t find what they’re looking for quickly, they’re likely to leave. The default WordPress search works fine for smaller sites, but as your content grows, it often falls short.
Elasticsearch is a practical way to improve that. Whether you’re setting it up manually or taking advantage of a hosting provider that already includes it, the result is the same: faster, smarter, more relevant search results.
If you’re on Cloudways, the good news is that both WP-CLI and Elasticsearch come pre-installed, so you’re already a few steps ahead. No need to deal with extra server configurations or installations. But if you’re managing your own setup, expect to spend a bit more time getting things running smoothly.
Either way, once Elasticsearch is in place and properly synced with your site, your visitors get a much better search experience, and that’s something every site should aim for.
Frequently Asked Questions
1. What is the best WordPress Elasticsearch plugin?
We have already seen ElasticPress in action, which is by far the simplest and most effective plugin. However, other plugins are available with additional functionalities, such as WPSOLR, a paid plugin.
2. What is Elasticsearch in WordPress?
Elasticsearch in WordPress is a tool that replaces the default search feature with a much faster and more intelligent system. It’s an open-source search and analytics engine that helps your WordPress site deliver more accurate and real-time search results.
3. Why is Elasticsearch used?
Elasticsearch is used to speed up and improve search performance, especially on content-heavy websites. It’s designed to handle large volumes of data and return relevant results in milliseconds. It’s also useful for geospatial searches (like finding results near a location), filtering, logging, and real-time monitoring. This makes it popular for both website search and backend analytics in modern web applications.
4. Is Elasticsearch free to use?
Yes, Elasticsearch is free to use under the open-source Elastic License. You can download and run it on your own server without paying anything. However, costs may arise depending on how you choose to host it. For example, using managed Elasticsearch services or integrating it with a paid hosting provider may involve additional fees.
Abdul Rehman
Abdul is a tech-savvy, coffee-fueled, and creatively driven marketer who loves keeping up with the latest software updates and tech gadgets. He's also a skilled technical writer who can explain complex concepts simply for a broad audience. Abdul enjoys sharing his knowledge of the Cloud industry through user manuals, documentation, and blog posts.