# How to get transaction id the greatest value elastic

**URL:** <https://discuss.elastic.co/t/how-to-get-transaction-id-the-greatest-value-elastic/101817>\
**Category:** Elasticsearch\
**Created:** [September 26, 2017, 10:05am UTC](https://discuss.elastic.co/t/how-to-get-transaction-id-the-greatest-value-elastic/101817 "2017-09-26T10:05:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tomer](https://avatars.discourse-cdn.com/v4/letter/t/41988e/32.png) [@tomer](https://discuss.elastic.co/u/tomer)\
**Post date:** [September 26, 2017, 10:05am UTC](https://discuss.elastic.co/t/how-to-get-transaction-id-the-greatest-value-elastic/101817/1 "2017-09-26T10:05:41Z")

</div>

Hi,

I have around 5 logs per transaction, every log has a timestamp and all 5 logs in a transactionId has a unique Id  
I am trying to find the latest (largest) timestamp for every transaction Id.

Many thanks

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [September 26, 2017, 10:29am UTC](https://discuss.elastic.co/t/how-to-get-transaction-id-the-greatest-value-elastic/101817/2 "2017-09-26T10:29:19Z")

</div>

The challenge is the high cardinality field that needs grouping on.  
You can use aggregations to do this but will likely need to break it down into chunks using [this partitioning approach](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-terms-aggregation.html#_filtering_values_with_partitions)

Alternatively you can use more of a streaming API to periodically sort the latest log raw records and compact down into an [entity-centric index](https://www.youtube.com/watch?v=yBf7oeJKH2Y) (the entity in your case being a transaction).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 24, 2017, 10:29am UTC](https://discuss.elastic.co/t/how-to-get-transaction-id-the-greatest-value-elastic/101817/3 "2017-10-24T10:29:29Z")

</div>

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