这是我的Mysql查询:
SELECT * FROM `provider` WHERE `active` = 'Y' GROUP BY `OfferID`, `offerName`, `duration`, `price`, `downloadSpeed`, `numChannels` LIMIT 10;
现在转换为Elasticsearch查询,它可以工作,
GET /promoapp_version_1_1/providerofferpromotionmaster/_search` "query": {
"bool": {
"must": [
{ "match": { "active": "Y" } }
]
}, "aggs": {
"group_by_val": {
"terms": {
"field": "offername.keyword"
},
"aggs": {
"group_by_price": {
"terms": {
"field": "price"
},
"aggs":{
"group_by_downloadspeed":{
"terms":{
"field":"downloadspeed"
},
"aggs":{
"group_by_duration":{
"terms":{
"field":"duration"
}
}
}
}
}
}
}
}
}
}`
如何在ES中按多个字段(offerName ,
,
价格,
downloadSpeed ,
numChannels)编写分组