# Get the max integer of an array

**URL:** <https://discuss.elastic.co/t/get-the-max-integer-of-an-array/153178>\
**Category:** Logstash\
**Created:** [October 19, 2018, 1:31pm UTC](https://discuss.elastic.co/t/get-the-max-integer-of-an-array/153178 "2018-10-19T13:31:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pierre2](https://avatars.discourse-cdn.com/v4/letter/p/da6949/32.png) [@Pierre2](https://discuss.elastic.co/u/Pierre2)\
**Post date:** [October 19, 2018, 1:31pm UTC](https://discuss.elastic.co/t/get-the-max-integer-of-an-array/153178/1 "2018-10-19T13:31:27Z")

</div>

Hello,

I'm looking for a way to get the max element of an array containing integer. I can't find any way to do that.

Here is how I created my array in a ruby filter :

> DateTab=[event.get('dateTransfertConseiller').to\_i,event.get('dateConsultation').to\_i,event.get('dateSante').to\_i,event.get('dateauto').to\_i,event.get('datehoraires').to\_i])

I want to get the element in the array DateTab that is the bigger. For example if DateTab = 1,5,89,51,264,120

The result shoud be 264

---

<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:** [November 16, 2018, 1:31pm UTC](https://discuss.elastic.co/t/get-the-max-integer-of-an-array/153178/2 "2018-11-16T13:31:30Z")

</div>

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