我们假设Oracle Schema具有以下表和列:
Country
country_id; (Primary Key)
country_name;
Department
department_id; (Primary Key)
department_name;
country_id; (Foreign key to Country:country_id)
Employee
employee_id; (Primary Key)
employee_name;
department_id; (Foreign key to Department:department_id)
我有我的Elasticsearch文档,其中根元素是国家/地区,它包含该国家/地区中的所有部门,而这些部门又包含相应部门中的所有员工.
所以文档结构如下所示:
{
"mappings": {
"country": {
"properties": {
"country_id": { "type": "string"},
"country_name": { "type": "string"},
"department": {
"type": "nested",
"properties": {
"department_id": { "type": "string"},
"department_name": { "type": "string"},
"employee": {
"type": "nested",
"properties": {
"employee_id": { "type": "string"},
"employee_name": { "type": "string"}
}
}
}
}
}
}
}
} …