Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

upload stopwords and synonyms to Elasticsearch cloud server

I have deployed my Elasticsearch server to the cloud: cloud.elastic.co

I have seen stopwords and synonyms documentation, which explain stopwords.txt/synonyms.txt files could be copied under config folder... but how can I do this on a cloud server?


I know I can pass the stopwords in an array, but using a file, it would be easier to update them:

Updating stopwords is easier if you specify them in a file with the stopwords_path parameter. You can just update the file (on every node in the cluster) and then force the analyzers to be re-created by either of these actions

like image 343
Hooman Bahreini Avatar asked Dec 12 '18 11:12

Hooman Bahreini


1 Answers

You have to use Custom Plugins section to manage any custom plugins, scripts or dictionaries (stopwords, synonymns, etc.) Steps:

  • Create a zip file with the following directory structure:

    .
    
    |__ dictionaries
    
        |__ stopwords.txt
    
  • Login to elastic cloud and go to Custom Plugins section

  • Click on Add Plugin

  • Fill in the relevant details and for the section Plugin Type select A bundle containing a dictionary or script

  • Click on Create Plugin

  • Go back to the Custom plugins page and click on the new plugin you just added.

  • Scroll to the bottom and upload the zip file created in first step.

Now you have to update your cluster so that its available to all the nodes. To do this follow the steps below:

  • Click on Deployment
  • Select your cluster/deployment form the page
  • On the menu in the left click on Edit.
  • Scroll to the section Elasticsearch plugins and settings on the page. Click on Manage plugins and settings.
  • From the expanded list select your bundle (located under Custom Plugins section in the expanded list).
  • On the bottom of the page click on Save Changes

Wait for the update activity to complete. Once completed you can now use stopwords.txt as below:

"stopwords_path": "stopwords.txt"

Here is the complete elastic cloud documentation. Documentation page for adding plugin/script/dictionary is here.

like image 55
Nishant Avatar answered Nov 15 '22 23:11

Nishant