When running a large website, chances of it starting to lag is very high due to a large number of search queries from the visitors, and may even end up crashing if you are not careful. This may not be so helpful especially if you are hosting a large number of visitors.
One setback that the WordPress website has is that it only conducts searches and matches based on the words that are in the title and content.
The worst thing is that it doesn’t match with categories and taxonomies that much. This has made WordPress receive a lot of backlash and criticism from users.
What comes to its rescue is the community of developers who are constantly trying to improve its search functionality since it’s an open-source platform.
It now has a vast array of tools and plugins for search optimization. One of these plugins is called Elastic search, that besides enhancing the result of a search, it also helps to improve website performance. This guide will show you how to configure Elastic search on WordPress.
Configuring Elastic search on WordPress isn’t as hard as it may seem, essentially if you are actively using Cloud ways. So let’s go ahead and do it.
What is an Elastic search?
Released in 2010, Elastic search is a tool used to run search queries in large databases fast. Compared to conventional searches, Elastic search is extremely fast around raw data and is a highly scalable search engine.
What contributes to this is its extensive API which integrates into any web application including WordPress for big data discovery. Elastic search contributes a lot in improving the not so good search capabilities of WordPress that are only good for small sites with small databases. The plugin offers real-time index updates adding a new document to the index instantly.
Why Use Elastic search?
This is a nifty WordPress plugin that helps large websites with directories and archives on various categories. Other websites that can use this tool are online stores with thousands of products and wish to reduce the searching time.
User experience is also improved as it narrows down further the search making it easy to find what they are looking for fast. Elastic search can also monitor applications in real-time which allow e-commerce stores to establish customer buying trends and check their marketing strategies accordingly.
Configure Elastic search on WordPress
Before configuring Elastic search on WordPress, you need to consider the following:
- Having an account with Cloud ways is mandatory with backup in place
- Have WordPress editing knowledge
- You should be familiar with WP-CLI.
Step 1: Enable Elastic search
You can enable Elastic search in the Cloud ways Platform, by heading to the “Settings & Packages” tab which is under the “Servers” screen. This enables Elastic search on your current server.
Step 2: Install Elastic Press on WordPress
Since this is a WordPress plugin, to install it, log in to your WordPress dashboard and add a new plugin by searching for Elastic Press.
An awesome feature of Elastic Press is that it communicates with your WordPress website on the server. The plugin developed by 10up.com. Compared to MySQL which is not designed for inherently complex search queries, Elastic search can do that fast and easy.
Elastic search is the perfect tool to conduct highly relevant searches, filtration, or any other sort of advanced search functionality with WordPress. You will love this plugin for its integration with Elastic Press and WordPress to give you extensive searches. This helps to make your users happy while conducting searches.
Step 3: Edit the wp-config.php File
The next thing you need to do is define IP and port where Elastic search is running from. Elastic search operates on the same server as your WordPress website on Cloud ways. You need to edit your wp-config.php file and define EP_HOST as below.
/** Elastic Press */
Define (‘EP_HOST’, ‘HTTP: //127.0.0.1:9200’);
Define Elastic Press in IP config
It should be noted that I added the local IP as Elastic Press runs on the same server as my WordPress. This is also my local environment. In your case, you will need to mention the server IP address where Elastic search is installed. You will have to reset permission by navigating to Application >>Management>> Application Settings, if you are cant upload the updated wp-config.php file. This allows you to connect your WordPress site to Elastic search on your server through the Elastic Press plugin.
Step 4: Build Indexes and Activate Elastic search
The last thing you need to do is to log in to your SSH terminal through the Cloud ways Platform. This allows you to build the ES indexes and activate the feature.
Head over to Server to log in to SSH terminal, and then Launch SSH Terminal or use Putty to connect to your server. Click on Applications from the top left bar and get into your specific application.
Applications Credentials at created from the right side, which will be used to access the application via SSH and SFTP.
Go back to the SSH Terminal window and use Elastic Press credentials to get into the application. You can also access the application from SSH Terminal inside your server dashboard.
Just launch the terminal and log in using your master credentials.
Run ‘CD applications’ command to access the applications running on this server inside your terminal window, and type ‘IS’ to get the list of applications.
There could be just one or ten applications running on your server. To access the one you need to work on, simply type the following command
CD [name of the application]
CD [name of the folder]
You now in the desired folder of your desired application. Allow WP-CLI to run Elastic Press specific commands since Cloud ways on WordPress have pre-installed with WP-CLI. You need to first run the following command to build ES indexes.
WP elastic press index –setup
Although Elastic Press usually activates itself after running the index, run this command to make sure it is enabled, to be safe.
If you are looking for an effective way to improve the search experience in your WordPress site, Elastic search offers the best way for such a task. You can use it on Woo-Commerce or any other online store. It can handle more queries without slowing down the site or crushing it.