首页新闻找找看学习计划

elasticsearch 筛选数组数量和查询两个属性之和的最小值

0
[待解决问题]

数据结构大概是这样

"list":[
{
"@timespan" : "2016-09-28T14:14:56.450024+08:00",
"_score" : 1,
"content" : {
"GoFlightInfos" : [
{
"AirCompanyCode" : "OZ",
"ArrAirportCode" : "PEK"
}
],
"HaveItinerary" : 2,
"IsAdjusted" : false,
"IsStandard" : false,
"MainAirCompanyCode" : "CA",
"MainBackAirCompanyCode" : "",
"MainBackSegmentIndex" : 0,
"MainSegmentIndex" : 0,
"ResConfigId" : 0,
"ResPrice" : {
"ZSumPrice" : 2915,

"aPrice":20
}
},
"id" : "39b71b2922a8411b1db79c5461efc3b"
}
]

我想查询1:GoFlightInfos这个数组只有一个元素的这个id=39b71b2922a8411b1db79c5461efc3b的这个实体

2: SELECT MIN(a.prop1+a.prop2) FROM TABLE a 查一个这样sql的查询语句怎么写

比如以上实例,我想把zsumprice+aprice加起来再求最低价.

目前我只知道

{
"page": {
"size": "0",
"from": "0"
},
"aggs": {
"comments": {
"nested": {
"path": "content"
},
"aggs": {
"minprice": {
"min": {
"field": "content.ResPrice.ZSumPrice"
}
}
}
}
}
}

这个是求zsumprice的最低价

感激不尽!!!

Melon1992的主页 Melon1992 | 菜鸟二级 | 园豆:202
提问于:2016-11-14 19:59
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册