雪花

数据同步

1、es配置

 查询集群名称

http://{ip}:9200/_cluster/health?pretty

如图所示:

 创建es映射文件

es文件夹下的创建t_user.yml文件

代码如下:

1
2
3
4
5
6
7
8
9
dataSourceKey: defaultDS
destination: example
groupId: g1
esMapping:
  _index: user
  _type: _doc
  _id: id
  sql: "select u.id,u.name,u.phone,u.gender,u.create_time from t_user u"
  commitBatch: 3000

如图所示:

 根据获取的数据结构

复制代码
GET my_test_index/_search
{
  "query": {
    "match_all": {}
  }
}

PUT /my_test_index
{
    "settings": {
        "number_of_shards": "1",
        "number_of_replicas": "0"
    },
    "mappings": {
        "properties": {
            "id": {
                "type": "long"
            },
            "name": {
                "type": "text"
            },
            "createtime": {
                "type": "date"
            }
        }
    }
}

DELETE /my_test_index?pretty

POST /my_test_index/_doc/1
{
  "id": 2,
  "name": "stono2",
  "createtime": "1999-11-11"
}
复制代码

如图所示

 

 

posted @   十色  阅读(69)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 地球OL攻略 —— 某应届生求职总结
· 提示词工程——AI应用必不可少的技术
· Open-Sora 2.0 重磅开源!
· 周边上新:园子的第一款马克杯温暖上架
历史上的今天:
2019-02-25 五、core开发
2019-02-25 三、oneinstack
2019-02-25 二、两条Linux删除数据跑路命令
2019-02-25 一、定时任务
  1. 1 少年 梦然
  2. 2 尘埃 林小柯
  3. 3 飞鸟和禅 任然
  4. 4 Dancing With Your Ghost Sasha Sloan
  5. 5 烟火人间 添儿呗
  6. 6 摘仙 伊格赛听、叶里
尘埃 - 林小柯
00:00 / 00:00
An audio error has occurred, player will skip forward in 2 seconds.
点击右上角即可分享
微信分享提示