gpt4 book ai didi

curl -X POST -d @mapping.json + 未创建映射

转载 作者:行者123 更新时间:2023-11-29 02:45:22 25 4
gpt4 key购买 nike

我正在学习 Elasticsearch 。我已经在“mapping.json”中指定了映射。其内容是

{
"book" : {
"_index" : {
"enabled" : true
},
"_id" : {
"index": "not_analyzed",
"store" : "yes"
},
"properties" : {
"author" : {
"type" : "string"
},
"characters" : {
"type" : "string"
},
"copies" : {
"type" : "long",
"ignore_malformed" : false
},
"otitle" : {
"type" : "string"
},
"tags" : {
"type" : "string"
},
"title" : {
"type" : "string"
},
"year" : {
"type" : "long",
"ignore_malformed" : false,
"index" : "analyzed"
},
"available" : {
"type" : "boolean",
"index" : "analyzed"
}
}
}
}

目前的映射是

$ curl -XGET http://localhost:9200/_mapping?pretty
=> {
"development_users" : {
"user" : {
"properties" : {
"email" : {
"type" : "string"
},
"first_name" : {
"type" : "string"
},
"id" : {
"type" : "string",
"index" : "not_analyzed",
"omit_norms" : true,
"index_options" : "docs",
"include_in_all" : false
},
"last_name" : {
"type" : "string"
},
"role" : {
"type" : "string"
}
}
}
}
}

我使用命令为书籍创建映射

$ curl http://localhost:9200/books -X POST -d @mapping.json
=> {"ok":true,"acknowledged":true}

但是当列出所有映射时,我得到:

$ curl -XGET http://localhost:9200/_mapping?pretty
=> { "books" : { },
"development_users" : {
"user" : {
"properties" : {
"email" : {
"type" : "string"
},
"first_name" : {
"type" : "string"
},
"id" : {
"type" : "string",
"index" : "not_analyzed",
"omit_norms" : true,
"index_options" : "docs",
"include_in_all" : false
},
"last_name" : {
"type" : "string"
},
"role" : {
"type" : "string"
}
}
}
}
}

为什么没有按照 mapping.json 文件中指定的方式创建图书映射?

最佳答案

请试试这个,

curl -XPUT 'http://localhost:9200/<indexname>/book/_mapping' -d @mapping.json

关于curl -X POST -d @mapping.json + 未创建映射,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19218659/

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