Search is one of the most important features of your WordPress website. It helps visitors quickly find blog posts, products, pages, and other content.
However, the default WordPress search may become slow or return less relevant results as your website grows.
Elasticsearch solves this problem.
Elasticsearch is a powerful search engine designed to deliver:
Faster search results
More accurate matches
Better handling of large amounts of content
In this guide, you will learn how to set up Elasticsearch on your WordPress website.
We will cover two scenarios:
Easy setup on Cloudways – Enable Elasticsearch directly from the Cloudways Platform
Manual setup – Install and configure Elasticsearch on your own server
By the end of this article, your WordPress site will be able to provide a faster and more reliable search experience.
What Is Elasticsearch?
Elasticsearch is a powerful search engine designed to quickly find information within large amounts of data.
Instead of using basic database searches, Elasticsearch creates a search index; a structured map of your website’s content.
This allows search queries to return results much faster and with better accuracy.
Elasticsearch is known for:
High search speed
Accurate and relevant results
Ability to handle large websites
Real-time content updates
When used with WordPress, Elasticsearch improves how your site searches through:
Posts
Pages
Products
Custom content
This helps resolve common issues with the default WordPress search, which may become slower or less effective as your website grows.
Elasticsearch also supports real-time indexing, meaning new or updated content can be added to the search results quickly.
Why Use Elasticsearch?
Elasticsearch is especially useful for websites that contain a large amount of content.
This includes:
Blogs with many articles
Business websites with multiple pages
Online stores with many products
Directory or listing websites
Using Elasticsearch can help you:
Improve search speed
Deliver more relevant search results
Enhance visitor experience
Reduce frustration from poor search results
For e-commerce websites, Elasticsearch can make it easier for customers to:
Find products faster
Filter results efficiently
Locate specific items
Elasticsearch can also be used for search analytics and monitoring. This means you can collect data about what visitors search for, which may help you understand:
Popular products or topics
User behavior patterns
Content gaps
This information can support better content planning and marketing decisions.
How to Configure Elasticsearch on WordPress on Cloudways
Enabling Elasticsearch on a WordPress application hosted on Cloudways is straightforward.
Cloudways allows you to activate Elasticsearch directly from the platform without performing complex server-level installations.
This setup is significantly easier than configuring Elasticsearch manually on a self-managed server.
Follow the steps below to enable Elasticsearch and connect it with your WordPress website.
Prerequisites
Before you begin, make sure the following requirements are met:
You have an active Cloudways account
You have a WordPress application deployed on Cloudways
You have access to your WordPress dashboard
You are able to edit WordPress files (if required)
Basic familiarity with WP-CLI is helpful (optional but recommended)
Note:
WP-CLI comes pre-installed on Cloudways WordPress servers.
Why these requirements matter
Cloudways account → Needed to access server settings
WordPress application → Elasticsearch connects to your site
WordPress dashboard access → Required to install ElasticPress
File editing access → Needed to configure connection settings
WP-CLI (optional) → Used for indexing content
Step #1 — Deploy a WordPress Application:
Before enabling Elasticsearch, you must have a WordPress application running on Cloudways.
If you already have a WordPress website on Cloudways, you can skip this step.
Log in to the Cloudways Platform
Click + Add Server
In 'Deploy your Managed Application' page, you need to choose what's suits you the most.
Select your application; in this case we are going with WordPress.
Choose your application stack, Hybrid or Lightning. (To learn about application stacks and which will suit you the most, click here)
Select your preferred Cloud provider (e.g., DigitalOcean, AWS, Google Cloud, Linode, Vultr).
Select your Database provider.
Choose your desired Server Size based on your traffic and resource needs.
Choose a Location closest to your target audience.
Review your selected configuration.
Click Launch Now.
Cloudways will begin deploying your server and installing WordPress. This process may take a few minutes.
Note:
If you already have a server, you can simply add a new WordPress application instead of launching a new server. Read the complete guide by clicking here.
Refer to the following navigation for adding an App on a server.
Step #2 — Enable Elasticsearch on Your Server:
Once your WordPress application is deployed, the next step is to enable Elasticsearch at the server level.
Elasticsearch runs as a server package and must be activated from the Cloudways Platform.
From the Cloudways Platform, click Flexible on the side tab and then click Servers in the top menu.
Select the server where your WordPress application is hosted.
Inside Server Management, click Settings & Packages from the left-side menu.
At the top of the Settings screen, Click the Packages tab.
This section allows you to manage optional server components.
In the Packages list, locate Elasticsearch.
Select the preferred version.
Click Install / Enable.
Note:
Cloudways supports Elasticsearch versions 7.17 and 8.11.
Older versions (such as 7.9) are no longer supported.
Step #3 — Install the ElasticPress Plugin
ElasticPress is a WordPress plugin that connects your website to Elasticsearch.
This plugin allows WordPress to send search requests to Elasticsearch instead of using the default WordPress search.
Follow these steps to install the ElasticPress plugin:
Log in to your WordPress dashboard.
Click Add Plugins.
Search for “ElasticPress“.
Click “Install Now“.
After installation, click Activate to enable the plugin.
Step #4 — Configure ElasticPress Connection
To allow WordPress to connect with Elasticsearch, you must add the Elasticsearch address to your wp-config.php file.
This tells ElasticPress where Elasticsearch is running.
Why is this step required?
ElasticPress needs the Elasticsearch host address to send search requests.
Without this configuration, the plugin cannot communicate with Elasticsearch.
Understanding the Elasticsearch Address
On Cloudways, Elasticsearch runs on the same server as your WordPress application.
Because of this, you can use the local server address:
127.0.0.1 → Refers to your own server (localhost)
9200 → Default Elasticsearch port
Access Your Server Files
Connect to your server using an FTP client such as FileZilla.
You will need:
Host
Username
Password
Port
These details are available in:
Servers → Master Credentials
Locate the wp-config.php File
After connecting via FTP:
Open the
public_htmlfolderFind the file named
wp-config.php
This file contains your WordPress configuration settings.
Once you have access to your server files, edit your
wp-config.phpfile and add the following line:
/** ElasticPress Host */
define( 'EP_HOST', 'http://127.0.0.1:9200' );
Note:
127.0.0.1 refers to the same server where your WordPress site is hosted. If Elasticsearch is installed on a different server, replace 127.0.0.1 with the correct server IP address or hostname.
Return to your WordPress Dashboard → ElasticPress, then complete Step 3 as shown in the screenshot below.
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:
After installing and configuring ElasticPress, your WordPress content must be indexed.
Indexing sends your website’s data to Elasticsearch so it can deliver faster and more accurate search results.
What does indexing mean?
Indexing is the process of copying your website’s content into Elasticsearch.
This includes:
Posts
Pages
Products
Custom content
Without indexing, Elasticsearch will not have any data to search.
Why is this step required?
ElasticPress needs to push your WordPress data to Elasticsearch.
This allows:
Faster searches
Better search accuracy
Improved user experience
How to index your content
You must connect to your server using SSH (Secure Shell). SSH allows you to safely run commands on your server.
Important:
Initial indexing is typically performed once during setup. You can re-index at any time if your website content changes significantly.
Now, follow the navigational steps below:
Head over to “Servers“.
Select the server on which you deployed your WordPress application.
Click Launch SSH Terminal to open a secure connection to your server.
Alternatively, you can use an external SSH client such as PuTTY.
Use your Username and Password to log in to your server.
In the SSH terminal:
Run
cd applicationsto open the applications directory.Run
lsto view the list of applications on the server.
Your server may contain one or multiple applications.
To configure a specific WordPress application, navigate to its folder using:
cd [application-folder-name]
Verify Your Current Directory
Ensure you are inside the correct application folder. This folder contains your WordPress files.
Run the ElasticPress Indexing Command
Once you are in the correct directory, run the WP-CLI command below:
wp elasticpress sync --setup
What does this command do?
This command:
Connects WordPress to Elasticsearch
Sends your website content to Elasticsearch
Builds the initial search index
Your indexed content may include:
Posts
Pages
Products
Custom fields
Why is this step important?
Indexing allows Elasticsearch to:
Deliver faster search results
Improve result accuracy
Replace default WordPress search queries
Note:
WP-CLI is pre-installed on all Cloudways WordPress servers.
Expected Result
After running the command, the terminal will display a success message and indexing progress.
After indexing completes, Elasticsearch is fully connected and indexed with your WordPress site via ElasticPress.
The screenshot above shows that 2 posts were successfully indexed.
This means your WordPress content has been correctly sent from the database to Elasticsearch.
Manual Elasticsearch Setup for WordPress (Requires Additional Steps)
If your WordPress website is hosted outside Cloudways, Elasticsearch can still be configured.
However, this setup requires additional server configuration steps.
This section explains the general requirements and provides an example local setup for demonstration purposes.
Prerequisites
Before proceeding, ensure you have:
A server or VPS with SSH access
WordPress installed
Permission to install server packages (root or sudo access)
Basic familiarity with terminal/command-line usage
Requirement Details
Server / VPS → Required to run Elasticsearch
WordPress Installation → Elasticsearch connects to your site
Root / Sudo Access → Needed to install Elasticsearch
Terminal Knowledge → Used to run setup commands
Example Setup Used in This Guide
For demonstration purposes, the following local environment is used:
Windows computer
XAMPP installed
Apache, MySQL, and PHP running
A working local WordPress website
Example:
Note:
You may use your own server or local development environment. The steps remain similar across most setups.
Step #1 - Install XAMPP (Skip if you already have it):
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:
Download WordPress
Download the ZIP file and extract it
Move WordPress to XAMPP
Copy the extracted wordpress folder
Paste it into this folder:
C:\xampp\htdocsRename it if you want (e.g.,
mywp), but for now, we’ll keep it as wordpress
So the path becomes: C:\xampp\htdocs\wordpress
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_dbClick Create
You now have a blank database for WordPress to use.
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
Email
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
Download the latest Windows ZIP version
2. Extract the Elasticsearch Files
Extract the downloaded ZIP file to a location on your system.
Example:
C:\elasticsearch
Note:
You may choose any folder location. Ensure you remember the path, as it will be used in later steps.
3. Temporarily Disable Security
Navigate to the Elasticsearch config directory:
C:\elasticsearch-9.0.4\configOpen the file named
elasticsearch.ymlin 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-adminGo to Plugins → Add New
Search for ElasticPress and click Install Now
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.phpAdd this line before
/* That’s all, stop editing! */:
define( 'EP_HOST', 'http://localhost:9200' );
Now, 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.
Completion Summary
You have successfully learned how to configure Elasticsearch with WordPress.
This guide covered:
Enabling Elasticsearch on Cloudways
Connecting ElasticPress
Indexing WordPress content
Manual setup for external hosting environments
Once Elasticsearch is properly configured and indexed, your WordPress site can deliver:
Faster search results
Improved search accuracy
Better performance on content-heavy websites
When should you re-index?
Re-indexing may be required if:
You add a large amount of new content
Search results appear outdated
You change Elasticsearch settings
ElasticPress is reconfigured
Need Assistance?
If Elasticsearch is not working as expected:
Verify Elasticsearch is running
Confirm the EP_HOST value
Re-run the indexing command
Check ElasticPress settings
Your enhanced WordPress search experience is now ready.
Frequently Asked Questions
What is the best Elasticsearch plugin for WordPress?
ElasticPress is one of the most widely used plugins for connecting WordPress with Elasticsearch.
It provides:
Easy integration
Reliable indexing
Advanced search features
Other plugins are also available, such as WPSolr, which may offer additional functionality but may require a paid license.
What is Elasticsearch in WordPress?
Elasticsearch in WordPress is a search solution that improves the default WordPress search.
Instead of relying only on the WordPress database, Elasticsearch:
Processes search queries faster
Returns more relevant results
Handles large websites more efficiently
Why is Elasticsearch used?
Elasticsearch is used to enhance website search performance.
Common benefits include:
Faster search responses
Improved result accuracy
Better filtering and querying
It is especially useful for:
Large content websites
E-commerce stores
Data-heavy applications
Elasticsearch can also support analytics, logging, and monitoring use cases.
Is Elasticsearch free to use?
Elasticsearch offers a free usage tier under the Elastic License.
You can install and run Elasticsearch on your own server without paying licensing fees.
However, costs may apply when using:
Managed Elasticsearch services
Cloud hosting infrastructure
Premium Elastic features
That’s it! We hope this article was helpful.
Need Help?
If you need assistance, feel free to:
Visit the Cloudways Support Center
Chat with us: Need a Hand > Send us a Message
Or create a support ticket anytime.
We're here 24/7 to help you!









