我的文件如下:
"id":4005,
"hotel_id":"258",
"hotel_city_code":"DXB",
"hotel_name":"NAIA BREEZE HOTEL APARTMENT BY DAMAC",
"hotel_star":"5",
"room_adults_child":"2-0"
_childDocuments_: [
{
map_date_rate:[
{date:0901, rate:207.09},
{date:0814, rate:207.09},
{date:0815, rate:159.50},
{date:0816, rate:200.00},
{date:0820, rate:207.09},
{date:0809, rate:207.09},
{date:0825, rate:207.09},
{date:0808, rate:207.09},
{date:0818, rate:207.09},
{date:0830, rate:207.09}
]
}
]
如何编写查询以查找具有以下条件的所有文档:
room_adults_child: 2-0
map_date_rate.date:(0814 AND 0815 AND 0816)
然后选择这些文件的以下字段:
id,
hotel_id,
room_rates:sum(map_date_rate.rate)
上面的room_rates 是一个虚拟字段,它将是搜索日期的总和:(207.09 + 159.50 + 200.00)= 566.59
感谢您的帮助。