使用文件的AWS Elasticsearch同义词 [英] AWS Elasticsearch synonyms using file

查看:190
本文介绍了使用文件的AWS Elasticsearch同义词的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am trying to add synonyms to elastic search as show in this link using a file but it gives me the following error 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}

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

My mapping code looks like this and synonyms.txt is within the same folder (same level):

'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' : ...


推荐答案

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

Actually your problem is that you apparently can't submit a synonyms file to AWS and the only way you can do to use synonyms with this configuration is to upload synonyms via API following:

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

对于大量同义词没有用。

which is not useful for a great number of synonyms.

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

See this other answer to a similar question for reference:

在指定同义词过滤器时使用同义词路径和使用同义词之间是否有区别Elasticsearch?

,直接从AWS论坛获取:

and this taken directly from AWS forum:

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

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

And btw, the path actually should be analysis/synonyms.txt, but again, only if you were able to upload the synonyms file to AWS.

这篇关于使用文件的AWS Elasticsearch同义词的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆