1、es配置
查询集群名称
http://{ip}:9200/_cluster/health?pretty
如图所示:
创建es映射文件
es文件夹下的创建t_user.yml文件
代码如下:
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" }
如图所示