mirror of
https://github.com/alibaba/canal.git
synced 2026-11-04 00:30:15 +08:00
Updated Sync ES (markdown)
68
Sync-ES.md
68
Sync-ES.md
@@ -208,6 +208,74 @@ left join (select user_id, group_concat(label order by id desc separator ';') as
|
||||
objFields:
|
||||
labels: array:;
|
||||
```
|
||||
- 父子文档索引
|
||||
|
||||
es/customer.yml
|
||||
```
|
||||
......
|
||||
esMapping:
|
||||
_index: customer
|
||||
_type: _doc
|
||||
_id: id
|
||||
relations:
|
||||
customer_order:
|
||||
name: customer
|
||||
sql: "select t.id, t.name, t.email from customer t"
|
||||
```
|
||||
es/order.yml
|
||||
```
|
||||
esMapping:
|
||||
_index: customer
|
||||
_type: _doc
|
||||
_id: _id
|
||||
relations:
|
||||
customer_order:
|
||||
name: order
|
||||
parent: customer_id
|
||||
sql: "select concat('oid_', t.id) as _id,
|
||||
t.customer_id,
|
||||
t.id as order_id,
|
||||
t.serial_code as order_serial,
|
||||
t.c_time as order_time
|
||||
from biz_order t"
|
||||
skips:
|
||||
- customer_id
|
||||
```
|
||||
mapping示例:
|
||||
```
|
||||
{
|
||||
"mappings":{
|
||||
"_doc":{
|
||||
"properties":{
|
||||
"id": {
|
||||
"type": "long"
|
||||
},
|
||||
"name": {
|
||||
"type": "text"
|
||||
},
|
||||
"email": {
|
||||
"type": "text"
|
||||
},
|
||||
"order_id": {
|
||||
"type": "long"
|
||||
},
|
||||
"order_serial": {
|
||||
"type": "text"
|
||||
},
|
||||
"order_time": {
|
||||
"type": "date"
|
||||
},
|
||||
"customer_order":{
|
||||
"type":"join",
|
||||
"relations":{
|
||||
"customer":"order"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 3 启动ES数据同步
|
||||
#### 启动canal-adapter启动器
|
||||
|
||||
Reference in New Issue
Block a user