On This Page:
- Required Plugins and Setup
- Introduction to Elasticsearch and ElasticPress
- How WPML ElasticPress Works
- Synchronizing and Indexing Content with WPML ElasticPress
- Known Issues
- Getting Help From Our Support
Required Plugins and Setup
Start by installing and activating the following:
- ElasticPress plugin
- WPML core plugin and WPML String Translation add-on
- WPML ElasticPress glue plugin
If you’re new to WPML, check out our Getting Started Guide.
Introduction to Elasticsearch and ElasticPress
Elasticsearch offers a fast and accurate way for you to manage your searchable content. The open-source tool indexes and categorizes your content, allowing you to analyze a wide variety of content types, including text documents and numeric and geospatial data.
ElasticPress integrates your WordPress website with Elasticsearch to upgrade the default WordPress search, query, and content relevance functionalities.
If you have a site with a lot of information, such as a WooCommerce store or community website, you can use ElasticPress to:
- Create a search with near-instant results while eliminating the strain on your WordPress database
- Handle complex queries, including full-text and fuzzy searches
- Add weights for content so that the focus of the queried search results is on the data of your choice
- Analyze large volumes of data to understand customer behavior and trends on your site
Once you install the ElasticPress plugin and connect to an Elasticsearch server, the plugin begins indexing your website’s data. This means it organizes all your website’s content (posts, pages, products, etc.) into a format that Elasticsearch can quickly process.
ElasticPress bundles its functionalities into features you can access by going to ElasticPress → Features.
Synchronizing Content with ElasticPress
ElasticPress automatically syncs content when you create, update, or delete it, ensuring your search index is always up-to-date.
In ElasticPress → Sync, you can additionally access the Sync Settings, which feature two indexing modes. These allow you to index current content from your WordPress website to Elasticsearch or delete existing data in your Elasticsearch index and create a new index from scratch with the current content of your WordPress site.
How WPML ElasticPress Works
WPML ElasticPress enables multilingual search functionality on your WPML and ElasticPress-powered WordPress site. It analyzes content in its original language, ensuring accurate indexing, and displays relevant content to users in their chosen language.
WPML ElasticPress achieves this by generating unique, language-specific indexes:
- Relevant Documents: Each index includes translations into the specific language for all post types set as translatable. For post types set to display translations if available or fallback to the default language, the index includes translations into that language plus posts in the default language. For non-translatable posts, each language index includes a copy of all items.
- Language-Specific Document Analysis: All documents in a language index undergo analysis and synchronization using tools, stopwords, and stemming for that language. This includes copies of posts in the default language.
- Search Results Pool: Each language index provides a pool of potential results for front-end search requests, related posts lists, and so on.
Supported ElasticPress Features
Currently, WPML ElasticPress supports the following ElasticPress features:
- Post Search for front-end searches
- Related Posts, using the widget provided by ElasticPress
- Terms, Comments, and Users for backend searches
Getting Started with WPML ElasticPress
Since WPML ElasticPress generates indexes for each language, we recommend that you re-index your posts after installing WPML ElasticPress and/or after updating from version 1.0 to 2.0 of WPML ElasticPress.
Please note that if your site is large, this process may take a few hours
You can do this either through the WordPress admin or by using the following command:
wp wpml_elasticpress sync --setup --post-type=post
Synchronizing and Indexing Content with WPML ElasticPress
WPML ElasticPress integrates directly with the Sync dashboard in ElasticPress → Sync. Instead of running a single sync process, the plugin triggers multiple syncs, one for each language on your multilingual site.
Whenever you create, modify, or delete a post, WPML ElasticPress automatically keeps the relevant content in sync. It updates the relevant indexes based on the language of the modified content or the translation setting for the post type.
Indexing with WP-CLI
If you have a large multilingual website with a lot of content to index, you may prefer command line indexing. WPML ElasticPress includes its own CLI command, wp wpml_elasticpress
, which expands the existing wp elasticpress command. It adds a --post-lang
option to specify the languages to sync. You can list multiple languages separated by commas. For example, wp wpml_elasticpress sync –post-lang=en,es
will only sync English and Spanish content.
Useful commands include:
wp wpml_elasticpress sync –setup
: Deletes all existing indices, and re-indexes all the content.wp wpml_elasticpress sync --per-page=200
: Syncs all content in batches of 200 items at a time, instead of the default 350 items per batch set by ElasticPress.wp wpml_elasticpress sync –post-type=post –post-lang=en,pt-pt
: Indexes only posts in specific languages. In this case, English and Portuguese. We explain how to use this command in detail below.
Indexing Only Posts From Specific Languages
The WPML ElasticPress glue plugin also allows you to only index posts in specific languages. To do this:
- Use the
wp wpml_elasticpress sync --setup --post-type=post --post-lang=en
command to index posts in a given language (in this case, English) and remove all existing indexes. - 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 sync --post-type=post --post-lang=fr
Known Issues
WPML works fine with this plugin, but sometimes there could be minor issues we're working on. This is expected as both plugins provide frequent updates.
Current unresolved issues:
You can also search all known issues including previously resolved issues for this plugin.
Getting Help From Our Support
In case you need help using ElasticPress on your multilingual site, visit WPML’s support forum.