# Filter data in Maps view with max field value

**URL:** <https://discuss.elastic.co/t/filter-data-in-maps-view-with-max-field-value/277435>\
**Category:** Kibana\
**Tags:** maps\
**Created:** [June 30, 2021, 9:15am UTC](https://discuss.elastic.co/t/filter-data-in-maps-view-with-max-field-value/277435 "2021-06-30T09:15:39Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![MAvD](https://avatars.discourse-cdn.com/v4/letter/m/f08c70/32.png) [@MAvD](https://discuss.elastic.co/u/MAvD)\
**Post date:** [June 30, 2021, 9:15am UTC](https://discuss.elastic.co/t/filter-data-in-maps-view-with-max-field-value/277435/1 "2021-06-30T09:15:39Z")

</div>

Hi,

In one of our Maps visualisation we want to show the data of the latest available measurement day. We would like to filter this data dynamically using a function similar to the Scaling option "Show top hits per entity." We want to show only the data of the latest available (max Year Day in this case) measurement day. Is this somehow possible? Thanks in advance!

---

<div class="post-metadata">

**Author:** ![jsanz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jsanz/32/53734_2.png) [@jsanz](https://discuss.elastic.co/u/jsanz)\
**Post date:** [July 1, 2021, 3:56pm UTC](https://discuss.elastic.co/t/filter-data-in-maps-view-with-max-field-value/277435/2 "2021-07-01T15:56:22Z")

</div>

Hi, @MAvD can you explain with some sample data why the`Top hits per entity` layer type does not work to you in your case?

---

<div class="post-metadata">

**Author:** ![MAvD](https://avatars.discourse-cdn.com/v4/letter/m/f08c70/32.png) [@MAvD](https://discuss.elastic.co/u/MAvD)\
**Post date:** [July 5, 2021, 7:10am UTC](https://discuss.elastic.co/t/filter-data-in-maps-view-with-max-field-value/277435/3 "2021-07-05T07:10:55Z")

</div>

Hi,

Maybe the following images can explain it better. This screenshot shows all data without the Top hits per entity filter, the doc count is limited to 10000 but shows all data in the currently selected global time filter:

 ![Screenshot 2021-07-05 085642 no filter](https://us1.discourse-cdn.com/elastic/original/3X/2/7/274ff45d60ebdbaf083f85412df707f7328fb24e.jpeg)

This screenshots shows the data with a Top hits per entity filter:

 ![Screenshot 2021-07-05 085728 top hits](https://us1.discourse-cdn.com/elastic/original/3X/c/6/c6114ad4893d9f6f453b42dcbc4a8c6d9c9b273d.jpeg)

As you can see, the Top hits per entity cuts out some data because each datapoint has its own location coordinates and has no other possible field to apply this filter on. This maybe could work on the "Plot Name" field but the max count of 100 docs is way to low for our purpose.

I actually want to show only the data where the "Year Day" field is equal to the maximum "Year Day" of the docs in the current view of the maps visualisation. Is there an option to query this latest available Year Day dynamically with some kind of max aggregation in the filter query?

---

<div class="post-metadata">

**Author:** ![jsanz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jsanz/32/53734_2.png) [@jsanz](https://discuss.elastic.co/u/jsanz)\
**Post date:** [July 5, 2021, 3:00pm UTC](https://discuss.elastic.co/t/filter-data-in-maps-view-with-max-field-value/277435/4 "2021-07-05T15:00:38Z")

</div>

> [@MAvD](#):
>
> Is there an option to query this latest available Year Day dynamically with some kind of max aggregation in the filter query?

Thanks for the screenshots and the extended explanation. Unfortunately, there's no such option in Elastic Maps nowadays. Both layer and global search bars don't accept any dynamic filtering, as far as I know.

It would be great if you could open a [feature request](https://github.com/elastic/kibana/issues/new?assignees=&labels=&template=Feature_request.md) in the Kibana repository with these details. Should that dynamic filter to be updated on each view change?

---

<div class="post-metadata">

**Author:** ![MAvD](https://avatars.discourse-cdn.com/v4/letter/m/f08c70/32.png) [@MAvD](https://discuss.elastic.co/u/MAvD)\
**Post date:** [July 6, 2021, 10:04am UTC](https://discuss.elastic.co/t/filter-data-in-maps-view-with-max-field-value/277435/5 "2021-07-06T10:04:53Z")

</div>

Thanks for your reply! In that case we can instruct our dashboard users to filter the latest available Year Day themselves.

---

<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:** [August 3, 2021, 10:05am UTC](https://discuss.elastic.co/t/filter-data-in-maps-view-with-max-field-value/277435/6 "2021-08-03T10:05:18Z")

</div>

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