ES–Kibana相关操作创建索引和Mapping
1.新建索引
PUT test_index/
2.创建别名
POST _aliases
{
“actions”: [
{
“add”: {
“index”: “test_index”,
“alias”: “test_index_name”
}
}
]
}
3.创建mapping
POST test_index/test_type/_mapping
{
"test_type": {
"dynamic": false,
"_all": {
"enabled": false
},
"properties": {
"wbbh": {
"type": "keyword"
},
"jyxkzbh": {
"type": "keyword"
},
"wbmc": {
"type": "text",
"analyzer": "smartcn",
"fields": {
"raw": {
"type": "keyword"
},
"standard": {
"type": "text",
"analyzer": "standard"
}
}
},
"zbx": {
"type": "keyword"
},
"zby": {
"type": "keyword"
},
"zby_zbx": {
"type": "keyword"
},
"lksj": {
"type": "keyword"
},
"wbdz": {
"type": "text",
"analyzer": "smartcn",
"fields": {
"raw": {
"type": "keyword"
},
"standard": {
"type": "text",
"analyzer": "standard"
}
}
},
"cjsj": {
"type": "date"
},
"rksj": {
"type": "date"
},
"gxdwmc": {
"type": "text",
"analyzer": "smartcn",
"fields": {
"raw": {
"type": "keyword"
},
"standard": {
"type": "text",
"analyzer": "standard"
}
}
},
"wbfzr": {
"type": "text",
"analyzer": "smartcn",
"fields": {
"raw": {
"type": "keyword"
},
"standard": {
"type": "text",
"analyzer": "standard"
}
}
},
"dt": {
"type": "keyword"
},
"type": {
"type": "keyword"
}
}
}
}
4.创建一个新的 people 索引,注意,将IP替换为你们自己的主机地址
### 创建一个新的 people 索引,注意,将IP替换为你们自己的主机地址
这里写自定义目录标题
PUT http://10.247.63.97:9200/people
Content-Type: application/json
{
“settings”: {
“number_of_shards”: 3,
“number_of_replicas”: 1
},
“mappings”: {
“properties”: {
“type”: {“type”: “keyword”},
“name”: {“type”: “text”},
“country”: {“type”: “keyword”},
“age”: {“type”: “integer”},
“date”: {
“type”: “date”,
“format”: “yyyy-MM-dd HH:mm:ss || yyyy-MM-dd || epoch_millis”
}
}
}
}