您好,登錄后才能下訂單哦!
先展示數(shù)據(jù)結(jié)構(gòu)如下:
{ "itemId": "132417862061", "site": "US", "sellerId": "aaaaa", "increamentId": "3753595", "ebayTrackList": [ { "numCount": 0, "pageView": 1, "userView": 1, "amountPaid": 0, "conversionRate": 0, "date": "2017-12-15" }, { "numCount": 0, "pageView": 1, "userView": 1, "amountPaid": 0, "conversionRate": 0, "date": "2017-12-29" }, { "numCount": 0, "pageView": 1, "userView": 1, "amountPaid": 0, "conversionRate": 0, "date": "2018-02-03" }, { "numCount": 0, "pageView": 1, "userView": 1, "amountPaid": 0, "conversionRate": 0, "date": "2018-03-12" }, { "numCount": 0, "pageView": 1, "userView": 1, "amountPaid": 0, "conversionRate": 0, "date": "2018-03-20" }, { "numCount": 0, "pageView": 1, "userView": 1, "amountPaid": 0, "conversionRate": 0, "date": "2018-03-24" }, { "numCount": 0, "pageView": 2, "userView": 1, "amountPaid": 0, "conversionRate": 0, "date": "2018-04-01" }, { "numCount": 0, "pageView": 1, "userView": 1, "amountPaid": 0, "conversionRate": 0, "date": "2018-04-02" } ], "publisher": "2714", "title": "MOTOSPEED LED Backlight 87 keys Bluetooth Mechanical Keyboard Red Switches T1W8", "sku": [ "C5060" ], "img": "https://cache.yisu.com/upload/information/20200310/72/153898.jpg?set_id=8800005007", "price": 55.05, "status": 1, "currency": "USD", "createTime": "1512074612", "updateTime": "1522694170", "mark": null, "fromCountry": "Shen Zhen", "oldSku": null }
目前的需求是假如我要知道2018-04-02,2018-04-03號(hào)的pageView之和,很明顯需要ebayTrackList.date過濾求和ebayTrackList.pageView字段
語(yǔ)句如下
{ "query":{ "bool" : { "must" : [ { "term" : {"itemId":"132417862061"} }, { "nested" : { "path" : "ebayTrackList", "query" : { "bool" : { "must" : [ { "terms" : {"ebayTrackList.date" : ["2018-04-03","2018-04-02"]} } ] } } } } ] } }, "aggs":{ "numTotalCount" : { "nested" : { "path" : "ebayTrackList" }, "aggs" : { "sd_value" : { "filter" : { "terms" : {"ebayTrackList.date" : ["2018-04-03","2018-04-02"]} }, "aggs" : { "sum_count" : { "sum" : { "field" : "ebayTrackList.pageView" } } } } } } } }
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。