I have an index in which each line has the field "name" and there are only about 15 names I'm dealing with. I also have a field called "lastUpdated" which is a of type Date.
What I have is a pie chart of names by count. For example: "Alex" appears 200 times, "Charlie" appears 100 times etc.
The problem is, I don't want names counted more than once if they appear in the same second of the "lastUpdated" timestamp.
What I want is to get the count by timestamp. For example, if "Bob" appears 156 times in between the "lastUpdated" stamp of 12:00:00 and 12:00:01, I want "Bob" to be counted only once. So, if "lastUpdated" timestamp is between 12:00:00 and 12:00:01, and we have "Bob" 156 times, "Charlie" 100 times and "Alice" 20 times, each name will get counted only once (Alice =1, Bob =1, Charlie =1). Now, between 12:00:01 and 12:00:02 if Bob appears 2 times, Alice appears 50 times, the aggregated values should be (Alice =2, Bob =2, charlie=1).
I simply want all of this to appear in a pie chart.
@kb2295 you can use a Scripted Field to truncate the milliseconds and then do a Unique Count. The following scripted field will truncate the millisecond: doc['@timestamp'].value.minus(doc['@timestamp'].value.getMillisOfSecond(), ChronoUnit.MILLIS)
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.