[英]Can't create two Types to same index elasticsearch & Kibana
I'm new in elasticsearch and kibana 我是弹性研究和kibana的新手
I'm doing some exercices with elasticsearch (create index,types and documents..) 我正在使用elasticsearch进行一些练习(创建索引,类型和文档......)
I created an index 'business' with type 'building' 我用类型'building'创建了一个索引'business'
put /business/building/217
{
"adresse":"11 Pen Ave",
"floors":5,
"offices":7,
"loc":{
"lat":40.693479,
"lon":-73.983854
}
}
it works funny but when I tried to create another type like this 它很有趣,但当我试图创建这样的另一种类型
put /business/employee/330
{
"name":"Richard Bell",
"title":"Senior Accountant",
"salar_usd":115000.00,
"hiredate":"Jan 19, 2013"
}
then I got this error 然后我收到了这个错误
{
"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
}
You're probably running Elasticsearch version 6 and as of that version ES doesn't allow you to create more than one type in any given index. 您可能正在运行Elasticsearch版本6,并且从该版本开始,ES不允许您在任何给定索引中创建多个类型 。
You need to store each of your document type inside a dedicated index, eg 您需要将每个文档类型存储在专用索引中,例如
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"
}
see https://www.elastic.co/guide/en/elasticsearch/reference/6.2/removal-of-types.html for more. 有关更多信息,请参阅https://www.elastic.co/guide/en/elasticsearch/reference/6.2/removal-of-types.html 。
Elasticsearch 6.x Indices created in 6.x only allow a single-type per index. 在6.x中创建的Elasticsearch 6.x索引仅允许每个索引使用单一类型。 Any name can be used for the type, but there can be only one. 任何名称都可以用于该类型,但只能有一个名称。 The preferred type name is _doc, so that index APIs have the same path as they will have in 7.0: PUT {index}/_doc/{id} and POST {index}/_doc 首选类型名称为_doc,因此索引API具有与7.0中相同的路径:PUT {index} / _ doc / {id}和POST {index} / _ doc
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.