I have a Magento 2 site with product titles and descriptions in Portuguese, that uses Elasticsearch as the catalog search engine. When I search for terms with accents the search results quality is very poor. Taking a stab at the issue I found out that magento creates the indices with an english stemmer, which is not appropriate for my case, as seen in the following image:

enter image description here

I know I can change the stemmer to be in portuguese, via direct manipulation on elasticsearch, but upon each magento indexer:reindex the old indice is deleted and a new one is created again with english, so that would not be a feasible solution.

Further digging into the issue I found that there's an esconfig.xml in the Magento_Elasticsearch module which is base to Magento_Elasticsearch6, with the following structure

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

I wonder what is the proper way to override this file as to make Magento use a portuguese stemmer by default?


1 Answer 1


I think No need to override any file.

Try below with the default system configuration, Magento does provides such a setting.

Stemmer works on the value configured on the store level.

  1. On the Admin sidebar, go to Stores > Settings > Configuration and switch to the specific store view if the website has multiple store views.
  2. In the left panel under General, choose General.
  3. Expand Expansion selector the Locale Options section
  4. unchecked Use Website if exists and Set Locale to the store language to Portuguese (Brazil) or Portuguese (Portugal) as per your convenience.
  5. Save config and clear cache if needed.

Run the catalog search index command - php bin/magento indexer:reindex catalogsearch_fulltext

For more info, https://docs.magento.com/m2/ce/user_guide/stores/locale-options.html#to-set-the-store-locale

  • After doing this the stemmer still remains as english. Mar 14, 2020 at 13:13
  • It should work unless some custom module changes.
    – sandip
    Mar 14, 2020 at 22:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.