【问题标题】:AWS Elasticsearch synonyms using file使用文件的 AWS Elasticsearch 同义词
【发布时间】:2017-08-01 09:02:59
【问题描述】:

我正在尝试使用文件将同义词添加到弹性搜索中,如此链接所示,但它给了我以下错误 https://www.elastic.co/guide/en/elasticsearch/reference/5.2/analysis-synonym-tokenfilter.html

error":{"root_cause":[{"type":"illegal_argument_exception","reason":"IOException while reading synonyms_path_path: ],"type":"illegal_argument_exception","reason":"IOException while reading synonyms_path_path:  (No such file or directory)"}},"status":400}

我的映射代码如下所示,并且 synonyms.txt 位于同一文件夹中(同一级别):

'settings': {
            'analysis': {
                'filter': {
                    'english_stemmer': {
                        'type': 'stemmer',
                        'language': 'english'
                    },
                    'english_possessive_stemmer': {
                        'type': 'stemmer',
                        'language': 'possessive_english'
                    },
                    'my_synonyms': {
                        'type': 'synonym',
                        'synonyms_path' : 'synonyms.txt'                        
                    }
                },
                'analyzer': {
                    'my_analyzer': {
                        'tokenizer': 'standard',
                        'filter': [
                            'english_possessive_stemmer',
                            'lowercase',
                            'my_synonyms',
                            'english_stemmer'
                        ]
                    }
                }
            }
        },
        'mappings' : ...

【问题讨论】:

  • 你是如何让词干分析器工作的——我收到一个{"error":{"root_cause":[{"type":"remote_transport_exception","re​​ason":[indices:admin/create ]"}],"type":"illegal_argument_exception","re​​ason":"未知设置 [index.filter.english_stemmer.language] 请检查是否安装了所有必需的插件,或检查重大更改文档以了解已删除的设置","抑制":[{"type":"illegal_argument_exception","re​​ason":"未知设置 [index.filter.english_stemmer.type] 请检查是否安装了任何必需的插件,或检查破坏性更改文档以了解已删除的设置"}] },

标签: elasticsearch


【解决方案1】:

实际上,您的问题是您显然无法向 AWS 提交同义词文件,而在此配置中使用同义词的唯一方法是通过以下 API 上传同义词:

https://www.elastic.co/guide/en/elasticsearch/reference/5.5/analysis-synonym-tokenfilter.html

这对于大量同义词没有用处。

请参阅类似问题的其他答案以供参考:

Is there any difference between using synonyms_path and using synonyms when specifying synonym filter for Elasticsearch?

这直接取自 AWS 论坛:

https://forums.aws.amazon.com/message.jspa?messageID=679800

顺便说一句,路径实际上应该是 analysis/synonyms.txt,但同样,前提是您能够将同义词文件上传到 AWS。

【讨论】:

  • “无法向 AWS 提交同义词文件”,这是主要问题。知道上传大量同义词的更好方法是什么吗?
【解决方案2】:

Elasticsearch 期望从配置位置接收到 synonyms.txt 的相对路径。例如,如果您的 synonyms.txt 位于 config/settings/synonyms.txt,则正确的路径是 "settings/synonyms.txt"

【讨论】:

    【解决方案3】:

    借助对自定义词典的支持,Amazon Elasticsearch Service 现在可以从 Amazon S3 导入您的词典文件,并根据需要将它们与您的 Amazon Elasticsearch Service 域关联。自定义字典支持适用于 Amazon Elasticsearch Service 上的所有 Elasticsearch 版本。要了解更多信息,请参阅文档

    documentation link

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-11-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多