Elasticsearch常用索引操作語句和查詢語句
# 查看全部索引 GET _cat/indices # 獲取一個文檔 GET /index/type/id # 刪除索引 DELETE /index # 查看mapping GET /index/_mapping # 創建索引mapping PUT /index { "mappings": { "type": { "properties": { "id": { "type": "integer" }, "industry": { "type": "text", "index": false }, "report_type": { "type": "text", "index": false }, "title": { "type": "text", "index":true }, "update_time": { "type": "date", "format":"yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis" }, "url": { "type": "text", "index": false } } } } } 說明 ignore_malformed:true 忽略格式錯誤的數值 # 部分更新 POST /index/type/id/_update { "doc": { "update_time": "2019-11-13 12:12:03" } } # 查詢,并過濾沒有刪除,分頁,時間排序 get /index/_search { "query": { "bool": { "filter": { "bool": { "must_not": { "term": { "is_del": 1 } } } }, "must": { "match_phrase": { "title": "國" } } } }, "size": 10, "from": 0, "sort": [ {"publish_date": {"order": "desc"}}, {"_score": {"order": "desc"}} ] } # 新增字段 PUT
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
數據類型
整數
byte 有符號的8位整數, 范圍: [-128 ~ 127]
short 有符號的16位整數, 范圍: [-32768 ~ 32767]
integer 有符號的32位整數, 范圍: [ ? 2 31 -2^{31} ?231 ~ 2 31 2^{31} 231-1]
long 有符號的32位整數, 范圍: [ ? 2 63 -2^{63} ?263 ~ 2 63 2^{63} 263-1]
浮點數
float 32位單精度浮點數
double 64位雙精度浮點數
數據類型可以參考
ES 15 - elasticsearch的數據類型 (text、keyword、date、object、geo等)
Elasticsearch 數據結構
版權聲明:本文內容由網絡用戶投稿,版權歸原作者所有,本站不擁有其著作權,亦不承擔相應法律責任。如果您發現本站中有涉嫌抄襲或描述失實的內容,請聯系我們jiasou666@gmail.com 處理,核實后本網站將在24小時內刪除侵權內容。