gpt4 book ai didi

elasticsearch - 无法为同一索引 elasticsearch 和 Kibana 创建两种类型

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

我是 elasticsearch 和 kibana 的新手

我正在使用 elasticsearch 做一些练习(创建索引、类型和文档……)

我创建了一个类型为“building”的索引“business”

put /business/building/217
{
"adresse":"11 Pen Ave",
"floors":5,
"offices":7,
"loc":{
"lat":40.693479,
"lon":-73.983854
}
}

它工作起来很有趣,但是当我尝试创建另一种类型时

put /business/employee/330
{
"name":"Richard Bell",
"title":"Senior Accountant",
"salar_usd":115000.00,
"hiredate":"Jan 19, 2013"
}

然后我得到了这个错误

{
"error": {
"root_cause": [
{
"type": "illegal_argument_exception",
"reason": "Rejecting mapping update to [business] as the final mapping would have more than 1 type: [employee, building]"
}
],
"type": "illegal_argument_exception",
"reason": "Rejecting mapping update to [business] as the final mapping would have more than 1 type: [employee, building]"
},
"status": 400
}

最佳答案

您可能正在运行 Elasticsearch 版本 6,从该版本开始,ES 不允许您创建 more than one type在任何给定的索引中。

您需要将每个文档类型存储在专用索引中,例如

PUT /business/building/217
{
"adresse":"11 Pen Ave",
"floors":5,
"offices":7,
"loc":{
"lat":40.693479,
"lon":-73.983854
}
}

PUT /employees/employee/330
{
"name":"Richard Bell",
"title":"Senior Accountant",
"salar_usd":115000.00,
"hiredate":"Jan 19, 2013"
}

关于elasticsearch - 无法为同一索引 elasticsearch 和 Kibana 创建两种类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47632846/

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