Elasticsearch and ElasticPress

4 min read


Elasticsearch is a feature available to all our users on the developer plan. This is a great feature for anyone who has a site that has a lot of information, for example, a large news website or blog, a knowledgebase, or a large e-commerce store.

If you’re coming from a managed hosting provider, there’s a good chance you can save a lot of money by making the switch over to GridPane. You can run it on as many websites as you need, and there’s no per website fee attached. 

One thing to note before you get started is that Elasticsearch can be resource-intensive.

What is Elasticseach?

Elasticsearch is an open-source search engine. Its scope goes far beyond WordPress and can be used for things like analytics, spotting data trends, machine learning and more.

For our purposes with WordPress, it’s an extremely fast and accurate search engine that replaces the default WordPress search function. You can use Elasticsearch and the ElasticPress plugin to index all of your website’s content, and then provide fast and accurate search results from this index faster than MySQL can run the same search.

You can use Elasticsearch to decrease search time, improve result accuracy, and create a customized search experience for your visitors.

The ElasticPress plugin has a great breakdown of all of the features it offers and it’s well worth a read:

Using Elasticsearch on GridPane

To get started with Elasticsearch, you first need to reach out to our support so we can install it for you on your server/s. We’ll have CLI and eventually a toggle for this feature in the future, but for now please shoot us an email to support@gridpane.com with your server name and IP address and we’ll take care it of it for you.

Once it’s been installed on your server you’ll then need to install and configure the ElasticPress plugin on your website/s.

NOTE: At the time of writing, Elasticsearch is having an odd issue with servers on DigitalOcean, returning 451 errors during the installation process and causing it to fail. This is something they’re looking into, and it’s not something we have any control over. We’ll do our best to keep this article up-to-date.

Configuring ElasticPress

Step 1. Install the plugin

The plugin is available from the WordPress repo – simply search for ElasticPress, then install and activate it like any regular plugin.

Step 2. Enter the Elasticsearch Host URL

In your settings page, we need to enter the host URL. 

The Elasticpress.io tab is for their paid integration. We need the “Third Party/Self Hosted” tab, and then enter HTTP://localhost:9200 in the Elasticsearch Host URL box. Then click Save.

Step 3. Index your content

Now we’ve connected the plugin to the server we can index your websites content. You should automatically be taken to the page where you can begin the process. Depending on the size of your database this can take some time.

Once complete, you may wish to check the “Index Health” page, and hit the refresh button in the top right-hand corner.

Step 4. Customize your search features

The ElasticPress plugin has a lot of customizable features that you can take advantage of to make your websites search experience even better for your target audience.

Each section has a “learn more” dropdown with information about what each feature does. 

The plugin also has two additional settings pages. One is for managing search fields and “weighting”. Weighting means prioritizing specific results, for example, giving weight to page titles or excerpts etc when a user performs a search.

The other page is for creating custom search results.

Configure as needed 🙂

ElasticPress Autosuggest

Inside Dashboard > ElasticPress > Features you’ll find the autosuggest feature:

Here you’ll see the following notice: 

You aren’t using ElasticPress.io so we can’t be sure your host is properly secured. Autosuggest requires a publicly accessible endpoint, which can expose private content and allow data modification if improperly configured.

Community Contribution

The following was provided to us by one of the GridPane community on how they implemented this on their website. You can also learn more here:

The following is for Nginx

To get started you’ll need to connect to your server – please see the following to get started:

On your server, run the following command to create your ElasticPress auto-search config (switching out site.url for your URL):

nano /var/www/site.url/nginx/elasticautosearch-main-context.conf

This is the community code snippet, modified from the original snippet from 10up:

					location /ep-autosuggest {
  # only allow POST requests
  limit_except POST {
    deny all;

  # Perform our request
  rewrite ^/ep-autosuggest(.*) $1/_search break;
  proxy_set_header Host $host;

  # Use the URL of the server here
  proxy_pass http://localhost:9200;
  return 403;

Check and Reload Nginx

Check the Nginx configuration file with:

nginx -t

If no errors are returned, reload Nginx with:

gp ngx reload

Enable Autosuggest

Back inside your website, add “ep-autosuggest” as your Endpoint URL, and set the status to Enabled. 

Note the message that says “Enabling this feature will require re-indexing your content.

When you’re ready, click Save.