{
"query": {
"match": {
"productName": {
"query": "牛奶"
}
}
},
"aggs": {
"shopIdagg": {
"terms": {
"field": "productId",
"order": {
"top_hit": "desc"
}
},
"aggs": {
"maxP": {
"max": {
"field": "salesPrice"
}
},
"top_test": {
"top_hits": {
"sort": {
"_score": "desc",
"salesPrice": "desc"
}
}
},
"top_hit": {
"max": {
"script":