ElasticPress plugin adds more robust search, indexing, and filter options to WordPress. Learn how to use WPML’s free ElasticPress glue plugin to make it work on your multilingual site.
The WPML ElasticPress glue plugin does the following:
- 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.
Start by installing and activating the following:
- ElasticPress plugin
- WPML core plugin and WPML String Translation add-on
- WPML’s ElasticPress glue plugin
To download WPML’s ElasticPress glue plugin, please visit our GitHub repository. Download the wpml-elasticpress.zip file and upload it to your site.
If you’re new to WPML, check out our Getting Started Guide.
Once the plugin is installed, re-index your posts. You can do this either through the WordPress admin, or using the following command:
<code>wp wpml_elasticpress index --setup --post-type=post</code>
When the re-indexing is complete, you’ll see relevant search results in each of your site languages.
The ElasticPress glue plugin also allows you to only index posts in specific languages. To do this:
- Remove any posts that have already been indexed by using the command
wp elasticpress delete-index
- Index posts for a given language (in this example, it’s English):
wp wpml_elasticpress index --setup --post-type=post --post-lang=en
- If you check your site’s front-end 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 languages, repeat step 2. Be sure to skip the –setup argument, otherwise you will remove the posts that have already been indexed). For example, you could use this:
wp wpml_elasticpress index --post-type=post --post-lang=fr
In case you need help using ElasticPress on your multilingual site, visit WPML’s support forum.
Don’t have WPML yet? You can test WPML for 30 days and see if you like it.
If you are not happy with our plugin, we refund you without any questions in the 30 days.