@@ -122,94 +122,40 @@ type=rpm-md
122122
123123- 如果就单个节点测试,新建索引的时候副本数记得填 0。
124124
125- #### 批量增加 / 删除测试数据
125+ #### 创建索引并设置 mapping
126126
127- - 官网文档:< https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html >
128- - 批量增加,接口地址:` POST /_bulk `
127+ - 官网类型说明:< https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping.html >
129128
130129```
131- { "index" : { "_index" : "grafanadb", "_type" : "radar", "_id" : "100001" } }
132- { "post_date" : "2018-12-01 10:00:00", "request_num" : 1 }
133- { "index" : { "_index" : "grafanadb", "_type" : "radar", "_id" : "100002" } }
134- { "post_date" : "2018-12-01 10:00:05", "request_num" : 2 }
135- { "index" : { "_index" : "grafanadb", "_type" : "radar", "_id" : "100003" } }
136- { "post_date" : "2018-12-01 10:00:10", "request_num" : 3 }
137- { "index" : { "_index" : "grafanadb", "_type" : "radar", "_id" : "100004" } }
138- { "post_date" : "2018-12-01 10:00:15", "request_num" : 4 }
139- { "index" : { "_index" : "grafanadb", "_type" : "radar", "_id" : "100005" } }
140- { "post_date" : "2018-12-01 10:00:20", "request_num" : 5 }
141- { "index" : { "_index" : "grafanadb", "_type" : "radar", "_id" : "100006" } }
142- { "post_date" : "2018-12-01 10:00:25", "request_num" : 6 }
143- { "index" : { "_index" : "grafanadb", "_type" : "radar", "_id" : "100007" } }
144- { "post_date" : "2018-12-01 10:00:30", "request_num" : 7 }
145- { "index" : { "_index" : "grafanadb", "_type" : "radar", "_id" : "100008" } }
146- { "post_date" : "2018-12-01 10:00:35", "request_num" : 8 }
147- { "index" : { "_index" : "grafanadb", "_type" : "radar", "_id" : "100009" } }
148- { "post_date" : "2018-12-01 10:00:40", "request_num" : 9 }
149- { "index" : { "_index" : "grafanadb", "_type" : "radar", "_id" : "100010" } }
150- { "post_date" : "2018-12-01 10:00:45", "request_num" : 10 }
151- { "index" : { "_index" : "grafanadb", "_type" : "radar", "_id" : "100011" } }
152- { "post_date" : "2018-12-01 10:00:50", "request_num" : 1 }
153- { "index" : { "_index" : "grafanadb", "_type" : "radar", "_id" : "100012" } }
154- { "post_date" : "2018-12-01 10:00:55", "request_num" : 2 }
155- { "index" : { "_index" : "grafanadb", "_type" : "radar", "_id" : "100013" } }
156- { "post_date" : "2018-12-01 10:01:00", "request_num" : 3 }
157- { "index" : { "_index" : "grafanadb", "_type" : "radar", "_id" : "100014" } }
158- { "post_date" : "2018-12-01 10:01:05", "request_num" : 4 }
159- { "index" : { "_index" : "grafanadb", "_type" : "radar", "_id" : "100015" } }
160- { "post_date" : "2018-12-01 10:01:10", "request_num" : 5 }
161- { "index" : { "_index" : "grafanadb", "_type" : "radar", "_id" : "100016" } }
162- { "post_date" : "2018-12-01 10:01:15", "request_num" : 6 }
163- { "index" : { "_index" : "grafanadb", "_type" : "radar", "_id" : "100017" } }
164- { "post_date" : "2018-12-01 10:01:20", "request_num" : 7 }
165- { "index" : { "_index" : "grafanadb", "_type" : "radar", "_id" : "100018" } }
166- { "post_date" : "2018-12-01 10:01:25", "request_num" : 8 }
167- { "index" : { "_index" : "grafanadb", "_type" : "radar", "_id" : "100019" } }
168- { "post_date" : "2018-12-01 10:01:30", "request_num" : 9 }
169- { "index" : { "_index" : "grafanadb", "_type" : "radar", "_id" : "100020" } }
170- { "post_date" : "2018-12-01 10:01:35", "request_num" : 10 }
171- { "index" : { "_index" : "grafanadb", "_type" : "radar", "_id" : "100021" } }
172- { "post_date" : "2018-12-01 10:01:40", "request_num" : 1 }
173- { "index" : { "_index" : "grafanadb", "_type" : "radar", "_id" : "100022" } }
174- { "post_date" : "2018-12-01 10:01:45", "request_num" : 2 }
175- { "index" : { "_index" : "grafanadb", "_type" : "radar", "_id" : "100023" } }
176- { "post_date" : "2018-12-01 10:01:50", "request_num" : 3 }
177- { "index" : { "_index" : "grafanadb", "_type" : "radar", "_id" : "100024" } }
178- { "post_date" : "2018-12-01 10:01:55", "request_num" : 4 }
179- { "index" : { "_index" : "grafanadb", "_type" : "radar", "_id" : "100025" } }
180- { "post_date" : "2018-12-01 10:02:00", "request_num" : 5 }
181- { "index" : { "_index" : "grafanadb", "_type" : "radar", "_id" : "100026" } }
182- { "post_date" : "2018-12-01 10:02:05", "request_num" : 6 }
183- { "index" : { "_index" : "grafanadb", "_type" : "radar", "_id" : "100027" } }
184- { "post_date" : "2018-12-01 10:02:10", "request_num" : 7 }
185- { "index" : { "_index" : "grafanadb", "_type" : "radar", "_id" : "100028" } }
186- { "post_date" : "2018-12-01 10:02:15", "request_num" : 8 }
187- { "index" : { "_index" : "grafanadb", "_type" : "radar", "_id" : "100029" } }
188- { "post_date" : "2018-12-01 10:02:20", "request_num" : 9 }
189- { "index" : { "_index" : "grafanadb", "_type" : "radar", "_id" : "100030" } }
190- { "post_date" : "2018-12-01 10:02:25", "request_num" : 10 }
191- { "index" : { "_index" : "grafanadb", "_type" : "radar", "_id" : "100031" } }
192- { "post_date" : "2018-12-01 10:02:30", "request_num" : 1 }
193- { "index" : { "_index" : "grafanadb", "_type" : "radar", "_id" : "100032" } }
194- { "post_date" : "2018-12-01 10:02:35", "request_num" : 2 }
195- { "index" : { "_index" : "grafanadb", "_type" : "radar", "_id" : "100033" } }
196- { "post_date" : "2018-12-01 10:02:40", "request_num" : 3 }
197- { "index" : { "_index" : "grafanadb", "_type" : "radar", "_id" : "100034" } }
198- { "post_date" : "2018-12-01 10:02:45", "request_num" : 4 }
199- { "index" : { "_index" : "grafanadb", "_type" : "radar", "_id" : "100035" } }
200- { "post_date" : "2018-12-01 10:02:50", "request_num" : 5 }
201- { "index" : { "_index" : "grafanadb", "_type" : "radar", "_id" : "100036" } }
202- { "post_date" : "2018-12-01 10:02:55", "request_num" : 6 }
203- { "index" : { "_index" : "grafanadb", "_type" : "radar", "_id" : "100037" } }
204- { "post_date" : "2018-12-01 10:03:00", "request_num" : 7 }
205- { "index" : { "_index" : "grafanadb", "_type" : "radar", "_id" : "100038" } }
206- { "post_date" : "2018-12-01 10:03:05", "request_num" : 8 }
207- { "index" : { "_index" : "grafanadb", "_type" : "radar", "_id" : "100039" } }
208- { "post_date" : "2018-12-01 10:03:10", "request_num" : 9 }
209- { "index" : { "_index" : "grafanadb", "_type" : "radar", "_id" : "100040" } }
210- { "post_date" : "2018-12-01 10:03:15", "request_num" : 10 }
130+ curl -XPUT 'http://127.0.0.1:9200/grafanadb' -H 'Content-Type: application/json' -d'
131+ {
132+ "settings": {
133+ "refresh_interval": "5s",
134+ "number_of_shards": 5,
135+ "number_of_replicas": 0
136+ },
137+ "mappings": {
138+ "radar": {
139+ "properties": {
140+ "request_num": {
141+ "type": "long"
142+ },
143+ "post_date": {
144+ "type": "date",
145+ "format": "yyyy-MM-dd HH:mm:ss||epoch_millis"
146+ }
147+ }
148+ }
149+ }
150+ }
151+ '
211152```
212153
154+
155+ #### 批量增加 / 删除测试数据
156+
157+ - 官网文档:< https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html >
158+ - 批量增加,接口地址:` POST /_bulk `
213159- cURL 格式:
214160
215161```
0 commit comments