嗨,我想在聚合上做一个过滤器,例如我想所有关键字都是first date>'2020-10-20'
我尝试了更多的解决方案,但不起作用
get /analityc/_search
{
"query":{
"match": {
"hashDomaine": "test"
}
},
"aggs":{
"nbkeyword":{
"terms": {
"field": "keyword.keyword",
"size": 10
},
"aggs": {
"minDate": {
"min": {
"field": "date"
}
}
}
}
}
}
示例数据点击,你可以网站我有一个日期的元素
ex data
"hits" : [
{
"_index" : "analityc",
"_type" : "_doc",
"_id" : "1",
"_score" : 8.002881E-5,
"_source" : {
"id" : 1,
"hashDomaine" : "fyher",
"click" : 0,
"impression" : null,
"ctr" : 0.0,
"position" : 74.0,
"url" : "urllll",
"country" : "fra",
"device" : "DESKTOP",
"date" : "2019-09-17T00:00:00+02:00",
"genre" : "",
"keyword" : "keyword 1 "
}
},
{
"_index" : "analityc",
"_type" : "_doc",
"_id" : "2",
"_score" : 8.002881E-5,
"_source" : {
"id" : 2,
"hashDomaine" : "fyher",
"click" : 0,
"impression" : null,
"ctr" : 0.0,
"position" : 83.0,
"url" : "urllll",
"country" : "esp",
"device" : "DESKTOP",
"date" : "2019-09-17T00:00:00+02:00",
"genre" : "",
"keyword" : "keyword 2"
}
},
{
"_index" : "analityc",
"_type" : "_doc",
"_id" : "3",
"_score" : 8.002881E-5,
"_source" : {
"id" : 3,
"hashDomaine" : "fyher",
"click" : 0,
"impression" : null,
"ctr" : 0.0,
"position" : 17.0,
"url" : "urllll",
"country" : "vnm",
"device" : "DESKTOP",
"date" : "2019-09-22T00:00:00+02:00",
"genre" : "",
"keyword" : "keyword2"
}
},
{
"_index" : "analityc",
"_type" : "_doc",
"_id" : "5",
"_score" : 8.002881E-5,
"_source" : {
"id" : 5,
"hashDomaine" : "fyher",
"click" : 0,
"impression" : null,
"ctr" : 0.0,
"position" : 51.0,
"url" : "urllll",
"country" : "tha",
"device" : "DESKTOP",
"date" : "2019-09-27T00:00:00+02:00",
"genre" : "",
"keyword" : "keyword2"
}
},
{
"_index" : "analityc",
"_type" : "_doc",
"_id" : "6",
"_score" : 8.002881E-5,
"_source" : {
"id" : 6,
"hashDomaine" : "fyher",
"click" : 0,
"impression" : null,
"ctr" : 0.0,
"position" : 34.0,
"url" : "urllll",
"country" : "usa",
"device" : "MOBILE",
"date" : "2019-09-26T00:00:00+02:00",
"genre" : "",
"keyword" : "keyword3"
}
},
{
"_index" : "analityc",
"_type" : "_doc",
"_id" : "6",
"_score" : 8.002881E-5,
"_source" : {
"id" : 6,
"hashDomaine" : "fyher",
"click" : 0,
"impression" : null,
"ctr" : 0.0,
"position" : 34.0,
"url" : "urllll",
"country" : "usa",
"device" : "MOBILE",
"date" : "2019-09-25T00:00:00+02:00",
"genre" : "",
"keyword" : "keyword4"
}
}
我想要一个关键字谁在2020-10-12之后有第一个日期,你看?
在本例中,我希望关键字min date>2019-09-23,te response是关键字3和关键字4,而不是关键字2,因为该关键字的日期<2019-09-23,明白吗?关键字1不是新关键字,因为在2019-09-23之前存在。我希望新关键字在日期之后存在
谢谢你的帮助
2条答案
按热度按时间2vuwiymt1#
我想,我找到了好答案:)
fsi0uk1n2#
您需要这样做: