在 ElasticSearch 中上传同义词文件

Upload Synonyms file in ElasticSearch

我是 ElasticSearch 的新手。我正在按照 article.

中的说明在 ElasticSearch 中设置同义词

有人可以帮助我如何将 synonym.txt 上传到 ElasticSearch 以便在设置中引用它吗?

由于您是 ES 的新手,建议您使用过滤器使用同义词的另一种方法,如您提到的同一官方 link 所示。

  "synonym": {
            "type": "synonym",
            "lenient": true,
            "synonyms": [ "foo, bar => baz" ] // please note this
          } 

不过,如果您想使用基于文件的同义词,您可以简单地通过 ssh 进入您的 ES 服务器,按照官方文档中的说明放置您的文件

The above configures a synonym filter, with a path of analysis/synonym.txt (relative to the config location). The synonym analyzer is then configured with the filter.