Yes, there are many unique IDs.
Is that the only way that this functionality can be achieved? Or is there an option to just have a complex aggregation?
I just want to understand if I have to create another index to solve this, or not.
Typically, yes.
On the plus side there's all sorts of interesting attributes you can derive other than "last known state" when you do this. For some background on the problem see the first half of this presentation. The solution I propose is outdated now that we have the transforms API to do the hard work but the underlying problem it addresses with aggregations on raw data is still the same.
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.