创建索引
预先设定好索引的setting和mapping
##创建索引 mapping+setting
PUT lsm-kibana_sample_data_flights
{
"settings": {
"number_of_shards": 5,
"number_of_replicas": 1
}
,
"mappings" : {
"properties" : {
"AvgTicketPrice" : {
"type" : "float"
},
"Cancelled" : {
"type" : "boolean"
},
"Carrier" : {
"type" : "keyword"
},
"Dest" : {
"type" : "keyword"
},
"DestAirportID" : {
"type" : "keyword"
}
}
}
}
reindex索引
重新设定索引的setting和mapping,并进行数据迁移
POST _reindex
{
"source": {
"index": "kibana_sample_data_flights"
},
"dest": {
"index": "lsm-kibana_sample_data_flights"
}
}
聚合操作
- 针对某个字段分组统计数量
# Zurich Airport
POST lsm-kibana_sample_data_flights/_search
{
"size": 0,
"aggs": {
"count_agg": {
"terms": {
"field": "DestWeather",
"size": 3
}
}
}
}