# Query for values not present for the last 90 days

**URL:** <https://discuss.elastic.co/t/query-for-values-not-present-for-the-last-90-days/309308>\
**Category:** Elasticsearch\
**Created:** [July 11, 2022, 10:39am UTC](https://discuss.elastic.co/t/query-for-values-not-present-for-the-last-90-days/309308 "2022-07-11T10:39:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ChristianOelsner](https://avatars.discourse-cdn.com/v4/letter/c/d9b06d/32.png) [@ChristianOelsner](https://discuss.elastic.co/u/ChristianOelsner)\
**Post date:** [July 11, 2022, 10:39am UTC](https://discuss.elastic.co/t/query-for-values-not-present-for-the-last-90-days/309308/1 "2022-07-11T10:39:15Z")

</div>

Hello forum,  
I am trying to wrap my head around a query.

In order to weed out some users i need to search for values in field "data.authenticationInfo.metadata.identifier.keyword" not present in the last 90 days.

Could a kind soul point me in the right direction on how to query for that?

Best regards

Oelsner

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [July 11, 2022, 3:54pm UTC](https://discuss.elastic.co/t/query-for-values-not-present-for-the-last-90-days/309308/2 "2022-07-11T15:54:23Z")

</div>

Some additional context might be useful. Are you using time-based indices? How much data do you have? What is the cardinality of the field you mentioned? Which version of Elasticsearch are you using?

---

<div class="post-metadata">

**Author:** ![Tomo\_M](https://avatars.discourse-cdn.com/v4/letter/t/848f3c/32.png) [@Tomo\_M](https://discuss.elastic.co/u/Tomo_M)\
**Post date:** [July 13, 2022, 1:37pm UTC](https://discuss.elastic.co/t/query-for-values-not-present-for-the-last-90-days/309308/3 "2022-07-13T13:37:05Z")

</div>

Answering the question without knowing the asked context, one possibility is that

1. terms aggregate on data.authenticationInfo.metadata.identifier.keyword
2. max aggregation of "time" field as a sub-aggregation for 1.
3. bucket selector aggregation for the result of max "time" field as a pipeline aggregation for 1.

---

<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 10, 2022, 1:37pm UTC](https://discuss.elastic.co/t/query-for-values-not-present-for-the-last-90-days/309308/4 "2022-08-10T13:37:21Z")

</div>

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