Skip Navigation
October 20, 2020

ElasticPress is a plugin that works with Elasticsearch to add more robust search, indexing, and filter options than are available in the standard WordPress search. In order to make it work on your multilingual site, you need WPML’s free ElasticPress glue plugin.

The WPML ElasticPress glue plugin:

  • Adds a language parameter to be able to filter search by language
  • Adds extra parameters to CLI commands to allow indexing of only specific languages

This makes it easier for your users to find what they’re looking for in the language they need. It also prevents the search results from displaying results in a mix of languages.

Downloading the ElasticPress glue plugin

To download WPML’s ElasticPress glue plugin, please visit our GitHub repository. Download the file and upload it to your site.

Using the ElasticPress glue plugin

Once the plugin is installed, re-index your posts. You can do this either through the WordPress admin, or using the following command: 

wp wpml_elasticpress index --setup --post-type=post

When the re-indexing is complete, you’ll see relevant search results in each of your site languages.

Indexing only posts from specific languages

The ElasticPress glue plugin also allows you to only index posts in specific languages. To do this:

  1. Remove any posts that have already been indexed by using the command wp elasticpress delete-index
  2. Index posts for a given language (in this example, it’s English): wp wpml_elasticpress index --setup --post-type=post --post-lang=en
  3. If you check your site’s frontend now, you’ll see only English posts in the search results on the English site. If you switch languages, the search results should be empty.

If you would like to index additional language, repeat step 2. Be sure to skip the –setup argument, otherwise you will remove the posts that have already been indexed): wp wpml_elasticpress index --post-type=post --post-lang=fr