Я пытаюсь создать несколько типов в одном индексе. Например, я пытаюсь создать два типа (host
, post
) в индексе ytb
, чтобы создать отношения родитель-потомок между ними.
PUT /ytb
{
"mappings": {
"post": {
"_parent": {
"type": "host"
},
"properties":{
"@timestamp": {
"type": "date"
},
"indexed": {
"type": "date"
},
"n_comments": {
"type": "long"
},
"n_harvested": {
"type": "long"
},
"n_likes": {
"type": "long"
},
"network": {
"fields": {
"keyword": {
"ignore_above": 256,
"type": "keyword"
}
},
"type": "text"
},
"parent_id": {
"fields": {
"keyword": {
"ignore_above": 256,
"type": "keyword"
}
},
"type": "text"
},
"post_dbid": {
"type": "long"
},
"post_id": {
"fields": {
"keyword": {
"ignore_above": 256,
"type": "keyword"
}
},
"type": "text"
},
"post_netid": {
"fields": {
"keyword": {
"ignore_above": 256,
"type": "keyword"
}
},
"type": "text"
},
"published": {
"type": "date"
}
}
},
"host": {
"properties": {
"@timestamp": {
"type": "date"
},
"@version": {
"fields": {
"keyword": {
"ignore_above": 256,
"type": "keyword"
}
},
"type": "text"
},
"country": {
"fields": {
"keyword": {
"ignore_above": 256,
"type": "keyword"
}
},
"type": "text"
},
"host_dbid": {
"type": "long"
},
"host_id": {
"fields": {
"keyword": {
"ignore_above": 256,
"type": "keyword"
}
},
"type": "text"
},
"host_netid": {
"fields": {
"keyword": {
"ignore_above": 256,
"type": "keyword"
}
},
"type": "text"
},
"id": {
"fields": {
"keyword": {
"ignore_above": 256,
"type": "keyword"
}
},
"type": "text"
},
"indexed": {
"type": "date"
},
"language": {
"fields": {
"keyword": {
"ignore_above": 256,
"type": "keyword"
}
},
"type": "text"
},
"name": {
"fields": {
"keyword": {
"ignore_above": 256,
"type": "keyword"
}
},
"type": "text"
},
"vertical": {
"fields": {
"keyword": {
"ignore_above": 256,
"type": "keyword"
}
},
"type": "text"
}
}
}
}
}
но я получаю эту ошибку:
{
"error": {
"root_cause": [
{
"type": "illegal_argument_exception",
"reason": "Rejecting mapping update to [ytb] as the final mapping would have more than 1 type: [post, host]"
}
],
"type": "illegal_argument_exception",
"reason": "Rejecting mapping update to [ytb] as the final mapping would have more than 1 type: [post, host]"
},
"status": 400
}
ОБНОВЛЕНИЕ: Версия Elasticsearch: 6.3.0