參考
https://www.elastic.co/guide/en/elasticsearch/reference/7.11/index.html
索引
GET /_cat/indices
GET /_cat/indices/content
GET /_cat/indices/content*
GET /content/_settings
GET /content/_mappings
PUT /content
{
"settings": {
"number_of_shards": 3, // 分片爲
"number_of_replicas": 0 // 副本數爲0
},
"mappings": {
"properties": {
"id": {
"type": "long"
},
"title": {
"type": "text"
},
"views_num": {
"type": "long"
},
"status": {
"type": "long"
},
"create_time": {
"type": "date",
"format": "yyyy-MM-dd HH:mm:ss"
}
}
}
}
DELETE /content
DELETE /content*
文檔
GET /_cat/indices/content
GET /content/_settings
GET /content/_mappings
POST /content/_delete_by_query
{
"query":{
"match_all": {}
}
}
POST /content/_doc/1
{"id": 1, "title": "來歷不明!韓國發現一條混凝土地道 專家建議申請文化遺產", "views_num": 10, "status": 1, "create_time": "2021-02-11 14:15:32"}
POST /content/_doc/2
{"id": 2, "title": "來歷不明!韓國發現一條混凝土地道 專家建議申請文化遺產", "views_num": 20, "status": 1, "create_time": "2021-02-12 14:15:32"}
POST /content/_doc/3
{"id": 3, "title": "來歷不明!韓國發現一條混凝土地道 專家建議申請文化遺產", "views_num": 30, "status": 1, "create_time": "2021-02-13 14:15:32"}
POST _bulk
{"create": {"_index": "content", "_id": "1"}}
{"id": 1, "title": "來歷不明!韓國發現一條混凝土地道 專家建議申請文化遺產", "views_num": 10, "status": 1, "create_time": "2021-02-11 14:15:32"}
{"create": {"_index": "content", "_id": "2"}}
{"id": 2, "title": "來歷不明!韓國發現一條混凝土地道 專家建議申請文化遺產", "views_num": 20, "status": 1, "create_time": "2021-02-12 14:15:32"}
{"create": {"_index": "content", "_id": "3"}}
{"id": 3, "title": "來歷不明!韓國發現一條混凝土地道 專家建議申請文化遺產", "views_num": 30, "status": 1, "create_time": "2021-02-13 14:15:32"}
POST /content/_bulk
{"create": {"_id": "4"}}
{"id": 4, "title": "來歷不明!韓國發現一條混凝土地道 專家建議申請文化遺產", "views_num": 40, "status": 1, "create_time": "2021-02-14 14:15:32"}
{"create": {"_id": "5"}}
{"id": 5, "title": "來歷不明!韓國發現一條混凝土地道 專家建議申請文化遺產", "views_num": 50, "status": 1, "create_time": "2021-02-15 14:15:32"}
POST /content/_search
{
"from" : 0,
"size" : 10
}
POST /content/_search
{
"query":{
"match_all": {}
}
}