一.本文基于 【ES】RestHighLevelClient连接阿里ElasticSearch7.10(一) 基础环境之上。记录对于es处于java中的相关业务需要做按月索引的实现
https://blog.csdn.net/ssdlleave/article/details/107846094?spm=1001.2014.3001.5501
方式:根据es模版自动创建索引。指定mapping类型
按月创建 根据创建时间 cretetime字段按月划分。追加索引名称后自动创建索引实现按月索引
定义es gis-location模版kibana添加
POST _template/template-gis-location
{
"template": "gis-location",
"order": 2,
"index_patterns": ["gis-location*"],
"aliases": {
"gis-location": {}
},
"settings": {
"index": {
"number_of_shards": "6",
"number_of_replicas": "1"
}
},
"mappings": {
"dynamic_templates": [{
"strings": {
"match_mapping_type": "string",
"mapping": {
"type": "keyword"
}
}
}],
"properties": {
"id": {
"type": "keyword"
},
"truckNumber": {
"type": "keyword"
},
"parkingTime": {
"type": "long"
},
"travelStatus": {
"type": "integer"
},
"sourceType": {
"type": "integer"
},
"accStatus": {
"type": "keyword"
},
"mileage": {
"type": "keyword"
},
"speed": {
"type": "keyword"
},
"provinceCode": {
"type": "keyword"
},
"cityCode": {
"type": "keyword"
},
"areaCode": {
"type": "keyword"
},
"provinceName": {
"type": "keyword"
},
"cityName": {
"type": "keyword"
},
"areaName": {
"type": "keyword"
},
"locationDetails": {
"type": "keyword"
&n