How to Make ElasticPress Return the Right Results per Language
Learn how to set up multilingual search on a WordPress site that runs WPML and ElasticPress. The WPML ElasticPress compatibility plugin builds a separate Elasticsearch index for each language on your site, so a visitor searching from the French version gets French results – never mixed with English or Japanese ones. This page covers the setup, the per-language sync, and, most importantly, how to verify that search returns the right results in every language.
There’s nothing to translate in the ElasticPress integration. The compatibility plugin makes ElasticPress return language-correct results automatically; your job is to install the pieces, run the initial sync, and confirm the results look right.
Before You Start
Install and activate these plugins on the same site:
- ElasticPress. The free open-source plugin from 10up, available on WordPress.org.
- WPML core plus WPML String Translation.
- WPML ElasticPress. The compatibility plugin. Download it from your WPML account downloads page.
You also need an Elasticsearch endpoint: self-hosted, or a managed service like ElasticPress.io, Elastic Cloud, or AWS OpenSearch. Configure ElasticPress against your Elasticsearch host and confirm it indexes successfully on a single-language site before adding the WPML layer.
Configure your WPML languages before running the first sync.
How Per-Language Indexing Works
WPML ElasticPress creates a separate Elasticsearch index for each language on your site. Each language’s index holds:
- Translations into that language for every translatable post type.
- Default-language posts for any post type set to fall back to the default language when a translation doesn’t exist.
- Copies of non-translatable posts. Every language’s index includes these so they can appear in search results regardless of the visitor’s language.
Every document in a language index is analyzed in that language. Stopwords, stemming, abbreviations, plural and tense handling are all language-specific. This is what makes French search match French stems and Japanese search match Japanese morphology; without per-language analysis, the search engine would apply one language’s rules to every other language’s text.
For each visitor’s search, WPML ElasticPress routes the query to the matching language index. The results pool is already filtered to the right language before relevance ranking starts.
Run the Initial Sync
With the four plugins active and an Elasticsearch endpoint configured in ElasticPress, run the initial sync:
- Open ElasticPress > Sync in the WordPress admin.
- Click Start Sync.
WPML ElasticPress triggers one sync per language and builds the per-language indexes one after another. On a large site this can take a few hours; the page reports progress as the sync runs.
If you’re updating from WPML ElasticPress 1.0 to 2.0 or later, re-index. The index format changed when version 2.0 introduced per-language indexes.
After the initial sync, content updates flow into the right index automatically. Whenever you create, modify, or delete a post, WPML ElasticPress updates the corresponding language index in the background based on that post’s language or the translation setting for its post type.
Indexing Specific Languages With WP-CLI
For large sites, scheduled jobs, deployment scripts, or any workflow where the admin UI isn’t an option, WPML ElasticPress provides a WP-CLI command (wp wpml_elasticpress sync) that wraps ElasticPress’s own CLI sync and adds a --post-lang flag for language selection.
Run the initial sync for English posts only:
wp wpml_elasticpress sync --setup --post-type=post --post-lang=en
The --setup flag clears existing indexes before rebuilding. After this command, English search returns English results; searches from other languages return nothing because their indexes haven’t been built yet.
Add a second language without clearing the existing indexes:
wp wpml_elasticpress sync --post-type=post --post-lang=fr
Repeat for each additional language. Omit --setup so previously indexed languages stay in place.
Sync several languages in one run:
wp wpml_elasticpress sync --post-lang=en,es
Adjust the batch size if memory is tight:
wp wpml_elasticpress sync --per-page=200
The default batch size is 350; lowering it helps on memory-constrained servers.
Rebuild every index from scratch:
wp wpml_elasticpress sync --setup
This clears every language index and rebuilds them all. Use this when something looks wrong across all languages or after a major upgrade.
How to Check That ElasticPress Searches Return Content in the Right Language
The technical sync is straightforward; the value of this page is in the verification. Walk through these checks after the initial sync completes, and again any time you change content or settings that affect search behavior.
1. Search Returns Same-Language Results From Each Language
From the front-end, switch the language switcher to each language in turn and search for a term you know exists in translated form.
- Pass. The results page lists only posts in that language.
- Fail. Results from other languages appear alongside same-language matches. The sync may not have completed for that language – check ElasticPress > Sync for errors and re-run the language-specific WP-CLI command.
2. Source-Language-Only Content Returns Zero Results in Other Languages
Pick a post that exists only in your default language – no translation in the other languages on the site. From a non-default-language version of the site, search for a phrase from that post.
- Pass. Zero results. The post isn’t translated into the visitor’s language, so it shouldn’t appear.
- Fail. The post appears in the results. This usually means the post type is set to fall back to the default language in WPML > Settings > Post Types Translation. That’s a WPML-level setting, not a bug. If you didn’t intend the fallback, change the setting.
3. Related Posts Stay Same-Language
Open a translated post on the front-end. The Related Posts widget should list other posts in the same language only.
- Pass. Every related post links to content in the same language as the current page.
- Fail. Related posts from other languages appear. Confirm the Related Posts feature is enabled in ElasticPress > Features and that the language index for the current language has finished syncing.
4. Document Search Filters by Language
If the Documents feature is enabled in ElasticPress: upload a translated PDF to the source-language version of a post, then upload a different-language PDF to its translation. Search for a phrase that appears only in the translated PDF.
- Pass. The search from the matching-language front-end returns the right PDF; the source-language search doesn’t return the translated PDF and vice versa.
- Fail. PDFs from other languages appear in the results. Re-sync after enabling Documents. The command
wp wpml_elasticpress sync --setuprebuilds every index with Document indexing.
5. Backend Searches (Terms, Comments, Users) Filter by Language
If you’ve enabled the Terms, Comments, or Users features in ElasticPress > Features, search them from the WordPress admin and confirm results filter by the current admin language. This affects users searching the back end of a multilingual site.
6. Multisite Sync Doesn’t Clear Sibling-Site Indexes
If you run WPML and ElasticPress on a Multisite network, run an index sync on one site and then check the other sites in the network. Their indexes should still be intact.
- Pass. Indexing one site leaves sibling sites’ indexes untouched.
- Fail. Sibling indexes are empty. Stop, re-run the syncs on the affected sites, and report the issue to WPML support so they can confirm whether you’re hitting a historical Multisite issue or a new one.
If every check above passes, your multilingual search is working as designed.
Supported ElasticPress Features
WPML ElasticPress currently makes the following ElasticPress features language-aware:
- Post Search. Front-end search across posts, pages, and custom post types.
- Related Posts. The related-posts widget filters to same-language matches.
- Documents. Search inside attached PDFs,
.docx,.pptx, and other file types. - Terms, Comments, and Users. Backend searches.
ElasticPress’s WooCommerce-specific search features (product discovery, faceted product filtering, instant product search across catalogues) are not currently multilingual. Multilingual coverage for WooCommerce search is on the WPML roadmap; until it lands, WooCommerce search on multilingual sites flows through WPML’s standard WooCommerce Multilingual handling, not through ElasticPress.
Common Pitfalls
- Sync didn’t run after enabling a new ElasticPress feature. Enabling Documents or Related Posts in ElasticPress > Features doesn’t retroactively add those documents to the index. Re-sync after toggling features.
- WP-CLI sync without
--setupafter a major change. If you’ve changed which post types are translatable, which features are enabled, or upgraded WPML ElasticPress across a major version boundary, runwp wpml_elasticpress sync --setupto rebuild every index from scratch. - Theme search-results template bypasses ElasticPress’s filters. Some custom themes implement their own search-results query that doesn’t go through ElasticPress. If results look wrong only on the front-end (and pass the admin checks), the theme template may need updating.
- WooCommerce product search returns mixed-language results. This isn’t a sync issue. It’s the WooCommerce coverage gap above. Route product search through WooCommerce Multilingual’s standard handling for now.
- Documents text doesn’t appear in search. Confirm the Documents feature is enabled in ElasticPress > Features and that a sync has run since enabling it.
Written by Amir · Last updated July 2, 2026