Updated Sync ES (markdown)

rewerma
2019-03-18 09:15:09 +08:00
parent cbe3987c28
commit bfadd0a211

@@ -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启动器