This website uses cookies

Our website, platform and/or any sub domains use cookies to understand how you use our services, and to improve both your experience and our marketing relevance.

How To Install and Enable Elasticsearch On Drupal 7

Updated on July 28, 2017

4 Min Read

My previous three posts focused on maximizing the speed of your Drupal 7 website by utilizing Redis, Varnish, and Memcache. These cache software greatly improves the page load speeds for the visitors.

ElasticSearch Drupal Banner

In this article, I’m going to take you in a different and equally useful direction. This is one area where large Drupal 7 websites could improve significantly. I am referring to important question, how to install Elasticsearch on Drupal 7. I will demonstrate how to use Elasticsearch for adding a powerful full website search engine to your Drupal 7 website.

First, let’s see what Wikipedia has to say about Elasticsearch: “Elasticsearch is a search engine based on Lucene. It provides a distributed, multitenant-capable full-text search engine with an HTTP web interface and schema-free JSON documents. Elasticsearch is the most popular enterprise search engine followed by Apache Solr, also based on Lucene.”

Stop Wasting Time on Servers

Cloudways handle server management for you so you can focus on creating great apps and keeping your clients happy.

Figuring out how to setup Elasticsearch for Drupal 7 could be a challenge. To help you out, I have created this guide to help you navigate the problem. Let’s take a look at the steps involved in the process:

  1. Install Elasticsearch on Cloudways server
  2. Install and enable the required modules on your Site
  3. Add search server
  4. Add search Index
  5. Create view

Before you start, make sure you have a Cloudways account and have already launched a server.

Install Elasticsearch on Cloudways

The first thing that you will need to do is install Elasticsearch on your Cloudways server. To do this, go to your server’s dashboard and navigate to the Manage Services tab in the left sidebar. From here, go to the Packages tab. Click the edit icon beside Elasticsearch and select the version of Elasticsearch you want from the drop-down menu. Wait a few minutes for the installation to finish.

CW server packages

That’s it for the Elasticsearch installation on the server.

Install and Enable Required Modules on the Website

Next, you will need to install Search API and Search API Elasticsearch modules and enable them on your Drupal website.

Add Search Server

Now the main portion of the solution begins!

Before going ahead, make sure you’ve got Composer setup on your website because it is the recommended (and the easiest) method for managing dependencies on your website.

Navigate to Admin > Configuration > Search and Metadata > Search API. Here, click Add Server at the top, which will bring you to the following screen. Name your server, and select Elasticsearch from the drop-down menu for Service class. Finally, create the server.

create search server

Note: If you get any errors about missing files, simply run composer update in the CLI.

Add Search Index

Merely adding the server is not enough, You also need an index of the contents of your website. This step depends upon the server you created in the previous step.

Go back to the Search API configuration and click Add Index at the top. Name your index, select search index from the drop-down menu in Item type. Click the checkbox beside enabled. Select the server you created in the previous step from the drop-down menu and then check Index Items Immediately. Finally, create the Index.

create Index

Note that you will need to index the items on your site when you make changes in the Search API configuration. To do that, simply navigate to the index you had created.

Create the View

Okay, so by now you have successfully setup Elasticsearch on your Drupal website. However, you still need to make it visible on the website and accessible to the users.

For this, create a view and place the block in the designated region. Go to Admin > Structure > Views > Create View. Here are the settings for the View (available in the documentation for Search API module):

  1. View name: Search
  2. Show: [the name of the Search index]
  3. Create a page [tick]
  4. Page title: Search
  5. Path: search
  6. Display format: Unformatted list of Rendered entity
  7. Items to display: 10, use pager

Continue & edit (the new View)

Format: Show: Rendered entity | Settings

  • View mode: Search results

Filter criteria

  • Fulltext search: Expose this filter, Required, Remember the last selection, Use as: search keys

Sort criteria

  • Search: Relevance, descending (if you don’t have an order with fuzzysearch you will get a PDO exception)

Page settings

  • Access: Permission: view published content


  • No results behaviour: Global: Text area “No results matched your search.”

Exposed form

  • Exposed form in block: Yes (This option will only show up on Page displays.)
  • Exposed form style settings: Submit button text: Search

Save the View.

Now, go to Admin > Structure > Blocks and place the block with the name of the view you created in your desired region.

place block in region


That’s it! now you know how to install Elasticsearch on Drupal 7 website. Even though the process is a bit complex and lengthy, it’s very much worth it since it provides your users the ability to search what they are looking for quickly without having to browse through the entire website.

If you need help with the process or would like to contribute to the discussion, do leave a comment below.


Share your opinion in the comment section. COMMENT NOW

Share This Article

Create interactive Drupal websites easily on the Cloud.

Host your website on optimized Drupal hosting servers.

Hamza Zia

Hamza is a Drupal Community Manager at Cloudways - A Managed Drupal Hosting Platform. He loves to write about Drupal and related topics. During his free time, he can be seen obsessing over Football, Cars, Android and Gaming.


Get Our Newsletter
Be the first to get the latest updates and tutorials.

Thankyou for Subscribing Us!


Webinar: How to Get 100% Scores on Core Web Vitals

Join Joe Williams & Aleksandar Savkovic on 29th of March, 2021.

Do you like what you read?

Get the Latest Updates

Share Your Feedback

Please insert Content

Thank you for your feedback!

Do you like what you read?

Get the Latest Updates

Share Your Feedback

Please insert Content

Thank you for your feedback!

Unleash The Cloud.
Not Budgets.

For 4 Months +
Up To 30 Free Migrations

Cyber Week

Time Left In Offer
  • 0


  • 0


  • 0


  • 0


40% OFF

On All Plans