Date histogram visualization of a sub-aggregation


(Mandycoston) #1

Hi,

I have documents with fields "publish_date" and "writer_id". I'd like a date histogram of the first published article by each writer_id. Can I visualize this on Kibana?

{
"size" : 0,
"aggs": {
"first_post": {
"date_histogram": {
"field": "publish_date",
"interval": "week",
"format": "yyyy-MM-dd"
},
"aggs": {
"authors" : {
"terms": {"field": "writer_id"},

    		"aggs" : {
    			"min_date" : {"min": {"field": "publish_date"}}
    		}
		}
	}
}

}
}


(kulkarni) #2

Hi

You would have to get the minimum-date for each published article by running the Min metric for their date field, with terms being each article . Not sure how/why you would like to plot this on a date-histogram.
I think you would first have to make sure the publish_date is a date field in Kibana (not a string) and I think it has to be the time field of the index pattern. It will depend on the schema of your data.

Thanks
Rashmi


(system) #3

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.