# Query within a specific time window

**URL:** https://discuss.elastic.co/t/query-within-a-specific-time-window/173628
**Category:** Elasticsearch
**Created:** [March 24, 2019, 9:11am UTC](https://discuss.elastic.co/t/query-within-a-specific-time-window/173628 "2019-03-24T09:11:25Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![eilon](https://avatars.discourse-cdn.com/v4/letter/e/c4cdca/32.png) [@eilon](https://discuss.elastic.co/u/eilon)
#### Post date: [March 24, 2019, 9:11am UTC](https://discuss.elastic.co/t/query-within-a-specific-time-window/173628/1 "2019-03-24T09:11:25Z")

</div>

Hi all,

I don't know if it's possible within the DSL query capabilities but would love to get some ideas or answers if it is.  
I want to write a query that matches two different documents within a time frame of, say, 15 minutes.  
The analogy is, looking for a causal relationship that wrapped in a finite time frame. "If P is true, then Q is also true".

I'll give a simple example from the world I'm coming from so I won't ruin the analogy:  
I want to find two documents that comes in a gap of 15 minutes, that obey the following demands:

1. "Name": "Malicious Command Line"
2. "Name": "Malicious File Created"

Please notice that it's not a filter query of a time range relative to now-15m but **any** 15 minutes in the past 24 hours for example.

I hope I described properly my problem, and hope even better that there's a solution for such a problem.

Thanks!

---

<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: [April 21, 2019, 9:11am UTC](https://discuss.elastic.co/t/query-within-a-specific-time-window/173628/2 "2019-04-21T09:11:29Z")

</div>

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