Having custom module dependency injection as follows:

  1. di.xml in app/code/Custom/Stopwords/etc directory.

    <type name="Magento\Elasticsearch\SearchAdapter\Query\Preprocessor\Stopwords">
         <argument name="stopwordsDirectory" xsi:type="string">app/code/Custom/Stopwords/etc/stopwords</argument>

  2. stopwords_en_US.csv in app/code/Custom/Stopwords/etc/stopwords directory copied from vendor.

Dev docs guide which i'm referring


I would like to add few stopwords in the .csv file. Have added the stop-words as follows:

more less some few other misc all

Issue - after adding the above stop-words it is not getting applied.

  • Is there any question or problem?
    – Mario
    Commented Dec 22, 2019 at 14:31

1 Answer 1


I ran into the same issue that you had following the documentation provided. You were following the Change Stopword Directory instead you want to follow the instructions under To change the directory from your module

In you custom module etc/di.xml file add in the following

<type name="Magento\Elasticsearch\SearchAdapter\Query\Preprocessor\Stopwords">
   <argument name="stopwordsModule" xsi:type="string">Your_Module</argument>
   <argument name="stopwordsDirectory" xsi:type="string">stopwords</argument>

Then make sure to copy vendor\magento\module-elasticsearch\etc\stopwords\stopwords.csv to app/code/Your/Module/etc/stopwords/stopwords.csv and add your words at the end of the file adding a new line for each word.

Once you are done I recommend rebuilding the indexes.

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.