1、查看狀態
GET /_cat/health?v
2、查詢索引全部數據
GET /ma_2020/_search
3、查詢索引mapping
GET /ma_2020/_mapping
4、刪除索引
DELETE /ma_2020
5、創建索引
PUT /ma_2020
6、設置mapping
PUT /qhpms_retail_headpremium/_mapping
{
"properties" : {
"@timestamp" : {
"type" : "date"
},
"@version" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
},
"agent_name" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
},
"agent_no" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
},
"c_crt_tm" : {
"type" : "date"
},
"dep" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
},
"dept_code" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
},
"dept_name" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
},
"insurance_preminum" : {
"type" : "float" #類型爲long時,kibana小數點後面可能會被省略
},
"policy_create_time" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
},
"type" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
}
}
}
7、時間範圍查詢
GET /ma_2020/_search
{
"query": {
"range": {
"@timestamp": {
"from": "2020-05-14T06:29:29.000Z",
"to": "2020-05-18T01:20:29.000Z"
}
}
}
}
8、查詢並刪除數據
GET /ma_2020/_delete_by_query
{
"query": {
"range": {
"@timestamp": {
"from": "2020-05-14T06:29:29.000Z",
"to": "2020-05-18T01:20:29.000Z"
}
}
}
}
9、導入一條數據
POST /pcis_work_dayly/_doc/123456789(唯一ID)
{
"dep_name": "廣東分公司",
"name": "車險",
"network": "互聯網",
"dayly_premium": 5,
"c_crt_tm": "2020-03-25",
"month_premium": 40,
"dayly_premium_icome": 5.03,
"year_premium_icome": 400,
"year_premium": 300,
"year_target": 2500,
"time_progress_task": 20.15
}
複雜操作可以查看我另外的文章。
ElasticSearch中distinct,count和group by的實現
ElasticSearch進行and,or,in,not in多條件組合DSL結構化查詢