Open
Conversation
未指定custom_dict_name时,直接访问ik配置文件中的url 当指定custom_dict_name时,访问url/custom_dict_name 举例: 1. ik配置文件中指定词典url为:http://dict.xxx.com/dict, 则默认访问的路径为http://dict.xxx.com/dict, 2. 当需要使用定制的词典路径时,则需要对ik分词器进行配置,参考: ``` PUT ik-test { "settings": { "analysis.analyzer": { "custom_ik": { "type": "ik_smart", "enable_remote_dict": true, "custom_dict_name": "custom_dict" } } }, "mappings": { "_doc": { "properties": { "field1": { "type": "text", "analyzer": "custom_ik" } } } } } POST ik-test/_analyze { "field": "field1", "text": "脑暴最棒加一" } ``` 此配置下将会访问http://dict.xxx.com/dict/custom_dict 获取词库
|
追加路径的方式设置remote_ext_dic,就很尴尬。既然是remote词库,有可能我需要某个索引的remote_ext_dic是路径完全不同的地址。例如:IIKAnalyzer设置是本地文件路径,而我某个索引希望设置一个 remote-api地址。。。或者说,我集群未设置remote_ext_dic,某个索引希望通过设置custom_dict_name的方式使用remote_ext_dic,都无法做到。 |
Author
我是用一个nginx做的分词服务器,如果子路径的文件不存在,就直接返回默认的词库(就是父路径那个地址),这样词典服务器很好维护:有用户有自定义词典需求时,创建一个文件夹,放入词典文件就行。对于外部的remote-api地址,通过nginx转发过去应该也可以实现,只不过remote-api的地址信息就不是配置在索引setting里了。 |
|
这样写稍微有点问题,如果某个索引不用了,这个字典似乎也会一直在es里面 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
未指定custom_dict_name时,直接访问ik配置文件中的url
当指定custom_dict_name时,访问url/custom_dict_name
举例:
则默认访问的路径为http://dict.xxx.com/dict,
此配置下将会访问http://dict.xxx.com/dict/custom_dict 获取词库