I have set up a Kibana / Elasticsearch instance to analyze some Data that i'm scraping. I am analyzing news Articles from different websites, i want to use a query / Filter that only shows me Articles once by using a cardinality aggregation on the Field "article_id".
To do so i have set up a Lens Visualization, added the Visualization to a Dashboard and got the Request from Visualization via the "Inspect" option. Then i tried to use the Request as a Filter in the Discover Tab ("Edit as Query DSL"). The only thing that seems to be affected by the query is the time. When i run the Query in the "Dev Tools" Section it does just fine.
My Request looks like this:
{
"aggs": {
"696b506b-2d7f-4bfc-9fab-704ca6e95d5c": {
"terms": {
"field": "article_title.keyword",
"order": {
"acbaafc6-829d-4c65-9b6b-cbca538c938e": "desc"
},
"size": 100
},
"aggs": {
"acbaafc6-829d-4c65-9b6b-cbca538c938e": {
"cardinality": {
"field": "article_id.keyword"
}
}
}
}
},
"size": 0,
"fields": [
{
"field": "run_date",
"format": "date_time"
},
{
"field": "scrape_date",
"format": "date_time"
}
],
"script_fields": {},
"stored_fields": [
"*"
],
"runtime_mappings": {},
"_source": {
"excludes": []
},
"query": {
"bool": {
"must": [],
"filter": [
{
"match_all": {}
},
{
"match_all": {}
},
{
"range": {
"run_date": {
"gte": "2021-04-02T23:49:43.440Z",
"lte": "2021-04-17T23:49:43.440Z",
"format": "strict_date_optional_time"
}
}
}
],
"should": [],
"must_not": []
}
}
}
Any help is greatly appreciated as this has been driving me insane the last few hours...