# Composite with max query in source

**URL:** https://discuss.elastic.co/t/composite-with-max-query-in-source/214117
**Category:** Elasticsearch
**Created:** [January 7, 2020, 7:21pm UTC](https://discuss.elastic.co/t/composite-with-max-query-in-source/214117 "2020-01-07T19:21:02Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![pjanzen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pjanzen/32/13756_2.png) [@pjanzen](https://discuss.elastic.co/u/pjanzen)
#### Post date: [January 7, 2020, 7:21pm UTC](https://discuss.elastic.co/t/composite-with-max-query-in-source/214117/1 "2020-01-07T19:21:02Z")

</div>

Hi all,

I am trying to get a max timestamp from a field inside an composite aggregation but I am unable to successfully do it.

I have tried this so far: [https://gist.github.com/pjanzen/ce752ac4f4fcdea4db9d9946237ba098](https://gist.github.com/pjanzen/ce752ac4f4fcdea4db9d9946237ba098)

Is what I want supported? Do I need a different approach?

Thanks for any insight.  
Paul.

---

<div class="post-metadata">

### Author: ![tamara](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tamara/32/47095_2.png) [@tamara](https://discuss.elastic.co/u/tamara)
#### Post date: [January 28, 2020, 12:01pm UTC](https://discuss.elastic.co/t/composite-with-max-query-in-source/214117/2 "2020-01-28T12:01:32Z")

</div>

Hi,

Can you please send an example of documents and also the expected output from the search?

---

<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: [February 25, 2020, 12:01pm UTC](https://discuss.elastic.co/t/composite-with-max-query-in-source/214117/3 "2020-02-25T12:01:40Z")

</div>

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