gpt4 book ai didi

docker - 无法在 ElasticSearch 上加载和使用 synonym.txt 文件

转载 作者:行者123 更新时间:2023-12-03 01:18:58 25 4
gpt4 key购买 nike

我正在使用以下 docker-compose.yml 创建 ElasticSearch 集群:

version: '3.3'
services:
elasticsearch1:
image: docker.elastic.co/elasticsearch/elasticsearch:7.6.2
container_name: elasticsearch1
environment:
...
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- data01:/usr/share/elasticsearch/data
- ${PWD}/data/thesaurus/output:/usr/share/elasticsearch/config/extra
ports:
- 9200:9200
networks:
- elastic
elasticsearch2:
...
volumes:
data01:
driver: local
data02:
driver: local
networks:
elastic:
driver: bridge

我的索引包含:

  "settings": {
"number_of_shards": 2,
"number_of_replicas": 1,
"index" : {
"analysis" : {
"filter" : {
"synonym" : {
"type" : "synonym",
"synonyms_path" : "extra/synonym.txt"
}
},
"analyzer" : {
"synonym" : {
"tokenizer" : "standard",
"filter" : ["lowercase", "synonym"]
}
}
}
}

当我尝试PUT 我的数据时,我得到:

{'error': {'root_cause': [{'type': 'illegal_argument_exception', 'reason': 'failed to build synonyms'}], 'type': 'illegal_argument_exception', 'reason': 'failed to build synonyms', 'caused_by': {'type': 'i_o_exception', 'reason': 'Is a directory'}}, 'status': 400}

有趣的是,当我运行:docker exec elasticsearch1 cat config/extra/synonym.txt 时,出现错误:cat: config/extra/synonym.txt: Is a directory

如何加载和使用 synonym.txt 文件?

最佳答案

如弹性文档中所写 - here :

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.

所以你替换了 synonyms_path :

"synonyms_path" : "/extra/synonym.txt" 

在:

"synonyms_path" : "extra/synonym.txt"

关于docker - 无法在 ElasticSearch 上加载和使用 synonym.txt 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61227043/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com