Is it possible to get last text field value on a transform aggregation?

Imagine we have an ecommerce, and an index with a document per every sale, with user and product fields. For each user I'd like to always know which is the last product they bought.
How could we tackle that?

Have a look at this:

https://www.elastic.co/guide/en/elasticsearch/reference/7.7/transform-painless-examples.html#painless-top-hits

This is part of the 7.7 documentation, however should work in older versions, too.

Awesome, thanks!

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