PUT /fruit/_bulk
{“index”:{}}
{“title”:“面包”,“price”:19.6,“description”:“小面包很便宜”}
{“index”:{}}
{“title”:“旺旺牛奶”,“price”:29.6,“description”:“旺旺牛奶很好喝”}
{“index”:{}}
{“title”:“日本豆”,“price”:9.0,“description”:“日本豆很便宜”}
{“index”:{}}
{“title”:“大辣条”,“price”:10.6,“description”:“大辣条超级好吃”}
{“index”:{}}
{“title”:“海苔”,“price”:49.6,“description”:“海苔很一般”}
{“index”:{}}
{“title”:“小饼干”,“price”:9.6,“description”:“小饼干很小”}
{“index”:{}}
{“title”:“小葡萄”,“price”:59.6,“description”:“小葡萄很好吃”}
{“index”:{}}
{“title”:“小饼干”,“price”:19.6,“description”:“小饼干很小”}
{“index”:{}}
{“title”:“小饼干”,“price”:59.6,“description”:“小饼干很小”}
{“index”:{}}
{“title”:“小饼干”,“price”:29.6,“description”:“小饼干很小”}
{“index”:{}}
{“title”:“小饼干”,“price”:39.6,“description”:“小饼干很小”}
![在这里插入图片描述](https://img-blog.csdnimg.cn/d220382e98e34a4ead7cc268e09636b6.png)
##### ③ 聚合操作使用
###### 根据某个字段分组
GET /fruit/_search
{
“query”: {
“match_all”: {
}
},
“aggs”: {
“price_group”: {
“terms”: {
“field”: “price”
}
}
}
}
![在这里插入图片描述](https://img-blog.csdnimg.cn/f4690cd99096406181e67661b771eaeb.png)
###### 求最大值
GET /fruit/_search
{
“query”: {
“match_all”: {}
},
“aggs”: {
“max_price”: {
“max”: {
“field”: “price”