gpt4 book ai didi

elasticsearch - Elasticsearch在索引模板中使用两个映射引发错误

转载 作者:行者123 更新时间:2023-12-02 22:48:08 25 4
gpt4 key购买 nike

如果我按如下方式定义索引模板文件template.json:

{
"template": "types",
"mappings": {
"type1": {
"properties": {
"title": {
"type": "text"
}
}
},
"type2": {
"properties": {
"title": {
"type": "keyword"
}
}
}
}
}

并尝试发布:
curl -XPUT http://localhost:9200/_template/types -d@template.json

我得到这个回应:
{
"error" : {
"root_cause" : [
{
"type" : "illegal_argument_exception",
"reason" : "mapper [title] cannot be changed from type [keyword] to [text]"
}
],
"type" : "illegal_argument_exception",
"reason" : "mapper [title] cannot be changed from type [keyword] to [text]"
},
"status" : 400
}

我希望能够在模板中定义具有不同类型的不同字段的多个映射。

我在做什么或假设不正确?

我正在使用Elasticsearch 5.6。

最佳答案

如果这些字段具有相同的名称,则即使您使用的是5.6版(这也是允许在同一索引中使用多种映射类型的最后一个版本),它们也必须具有相同的字段类型。

如果类型title中的type1字段映射为text,则类型title中的字段type2也需要映射为text

关于elasticsearch - Elasticsearch在索引模板中使用两个映射引发错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55304964/

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