Search in WordPress is very basic which query for like in a
database and give you the results. It doesn’t have indexing and
can degrade the performance if lots of search activity on your
It’s probably ok if you don’t have search functionality on your
blog. However, if you expect visitors to perform a search then
you must consider looking for alternative seriously.
If you are not sure whether people search on your website then
Analytics will help you to find out.
- Login to Google Analytics
- Go to Behavior >> All Pages
- Search for ?s and see the number of
queries was searched
In last 30 days, I received 314 queries with 453 page views.
It’s not very high but still worth considering some
Another problem with WordPress inbuilt search is when you query
for something and if it doesn’t match exactly then it will not
give any results.
For ex: I searched for “Seo Analyser” and say
To improve the searchability in WordPress, you can consider the
Elastic Search . Elastic Search is
one of the most popular open sources search softwares with
- Real-time data & analytics
- High availability
- Full-text search
- Document oriented
- Built on Apache Lucene and developed in Java
Note: your website must be hosted on VPS
instead of shared hosting as you need to install ElasticSearch
software on it.
The following demonstration is done on Linode’s VPS – Ubuntu .
Installing Elastic Search
- Login into your VPS with root
- Sign the package with below command
wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
- Add the repository to the list
echo "deb https://packages.elastic.co/elasticsearch/2.x/debian stable main" | sudo tee -a /etc/apt/sources.list.d/elasticsearch-2.x.list
apt-get update && apt-get install elasticsearch
- Add elastic search at boot so when server reboot it start
update-rc.d elasticsearch defaults
ElasticSearch is developed in Java so you need to have java
installed before you start it. To install execute the following
apt-get install default-jdk
Once installed, verify by executing java
[email protected] :/etc/init.d# java -version java version "1.7.0_101" OpenJDK Runtime Environment (IcedTea 2.6.6) (7u101-2.6.6-0ubuntu0.14.04.1) OpenJDK 64-Bit Server VM (build 24.95-b01, mixed mode) [email protected] :/etc/init.d#
Starting Elastic Search
You are all set to start ElasticSearch. Go to /etc/init.d and
execute following to start them.
Note: Elastic Search by default starts on 9200
port. So if you want to access console, you can use
Integrating ElasticSearch with WordPress
Now, the final step is to integrate elastic search with the
WordPress. Thanks to “ Fantastic ElasticSearch ”
plugin which makes things super easy.
- Login to WordPress and install Fantastic ElasticSearch
- Once installed, click on ElasticSearch at left navigation
for following basic configuration.
Under WordPress integration tab
- Tick the checkbox for “Enable Search”
- Tick the checkbox for “Enable for All category archives”
Under Server Settings tab
Under Result Scoring
- Enter fuzziness amounts to 1
Fuzziness is important and setting this value to 1 means if the
user gives any one character wrong it will still match the
Be careful with fuzziness amount, having this
higher will have performance impact so you may want to limit
with 1 or maximum 2.
Under Manage Index tab
- Click on Reindex Data and don’t forget to Save Changes
Now, let’s take above example, I searched for “SEO Analyser”
and it didn’t give any result because I had articles contain
Let’s see what the results look like:
Awesome! As you can see it has searched for
the article, which has “SEO Analyzer” keyword.
Above are basic configurations and if you think need more
configurations then go through plugin settings. ElasticSearch
is a great replacement of inbuilt WordPress search and I hope
this article helps you in implementing them.