A multi-bucket value source based aggregation that enables the user to define a set of ranges-每一个表明一个bucket。html
在聚合过程当中,从每一个文件中提取的值将根据每一个存储区范围进行检查,并对相关/匹配文档进行“bucket”,值得注意的是,注意,此聚合包含了from值,不包括每一个范围的to的值。apache
例子:json
{ "aggs" : { "price_ranges" : { "range" : { "field" : "price", "ranges" : [ { "to" : 50 }, { "from" : 50, "to" : 100 }, { "from" : 100 } ] } } } }
响应结果:app
{ ... "aggregations": { "price_ranges" : { "buckets": [ { "to": 50, "doc_count": 2 }, { "from": 50, "to": 100, "doc_count": 4 }, { "from": 100, "doc_count": 4 } ] } } }
http://cwiki.apachecn.org/pag...elasticsearch
发送 put 请求ide
192.168.2.11:9200/IndexName
文本raw,数据为json格式post
{ "settings":{ "number_of_shards":5, "number_of_replicas":1 }, "mappings":{ "TypeName":{ "dynamic":"strict", "properties":{ "tableId":{"type":"string","store":"yes","index":"not_analyzed"}, "title":{"type":"string","store":"yes","index":"analyzed","analyzer": "ik_max_word","search_analyzer": "ik_max_word"}, "author":{"type":"string","store":"yes","index":"analyzed","analyzer": "ik_max_word","search_analyzer": "ik_max_word"}, "summary":{"type":"string","store":"yes","index":"analyzed","analyzer": "ik_max_word","search_analyzer": "ik_max_word"}, "contextSrc":{"type":"string","store":"yes","index":"not_analyzed","ignore_above": 100}, "context":{"type":"string","store":"yes","index":"analyzed","analyzer": "ik_max_word","search_analyzer": "ik_max_word"}, "keywords":{"type":"string","store":"yes","index":"analyzed","analyzer": "ik_max_word","search_analyzer": "ik_max_word"}, "publishDate":{"type":"string","store":"yes","index":"not_analyzed"}, "createTime":{"type":"string","store":"yes","index":"not_analyzed"}, "modifyTime":{"type":"string","store":"yes","index":"not_analyzed"}, "deleteTime":{"type":"string","store":"yes","index":"not_analyzed"}, "url":{"type":"string","store":"yes","index":"not_analyzed"}, "isDeleted":{"type":"string","store":"yes","index":"not_analyzed"} } } } }
PUT http://ip:port/indexname/ui
{ "settings":{ "index":{ "number_of_shards":5, "number_of_replicas":1 } }, "mappings":{ "koms_aibox_currentgpsclose":{ "properties":{ "id":{"type":"keyword"}, "transit_time":{"type":"keyword"}, "alerm_state":{"type":"keyword"}, "gps_time":{"type":"keyword"}, "travel_time":{"type":"keyword"}, "abnormal_coos":{"type":"keyword"}, "date":{"type":"keyword"} } } } }
注:url
https://ask.hellobi.com/blog/...spa
http://www.cnblogs.com/sunny3...
https://blog.csdn.net/liuxiao...
示例
XPOST ip:port/indexname/typename/_bulk
格式说明
post ip:port索引/类型/_bulk
使用 POSTMAN 批量导出数据
POST http://ip:port/indexname/typename/3
说明:
3 是 id,可写可不写,不写自动生产
{ "tgs_id":"433100100153", "field1":"value1", "field2":"value2", "field3":"value3", "field4":"value4" }
pass_car
{ "tgs_id":"433100100153", "field1":"value1", "field2":"value2", "field3":"value3", "field4":"value4" "time_frame": "9" }
https://blog.csdn.net/hzrandd...
https://blog.csdn.net/xsdxs/a...
XGET http://ip:port/indexname/typename/_search?scroll=10m
BODY
{ "query": { "match_all": {}}, "size": 1000 }
GET http://ip:port/_cat/indices?v
DELETE /my_index
DELETE /index_one,index_two DELETE /index_*
DELETE /_all DELETE /*