# Sliding Window Query in Elastic

**URL:** https://discuss.elastic.co/t/sliding-window-query-in-elastic/344733
**Category:** Elasticsearch
**Created:** [October 10, 2023, 12:26pm UTC](https://discuss.elastic.co/t/sliding-window-query-in-elastic/344733 "2023-10-10T12:26:12Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![vignesh\_nayak](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vignesh_nayak/32/124740_2.png) [@vignesh\_nayak](https://discuss.elastic.co/u/vignesh_nayak)
#### Post date: [October 10, 2023, 12:26pm UTC](https://discuss.elastic.co/t/sliding-window-query-in-elastic/344733/1 "2023-10-10T12:26:12Z")

</div>

Hello, I have a log message which has an id, and it will be same for repeating requests. So I need to find repetitive requests from same id in a certain interval(ex:15min) , What would be the easiest way to achieve this, It should be based on sliding window?  
Ex:  
message: Id= 1  
Time:10:00  
message: Id= 1  
Time:10: 05  
message: Id=2  
Time:10: 07  
message: Id= 2  
Time: 10:12  
message: Id= 2  
Time:10: 24  
message: Id= 3  
Time: 10:30  
message: Id= 3  
Time: 11:00  
Output  
id: 1 Count: 1  
id: 2 Count: 2  
id: 3 Count: 0  
Output Based on sliding window for 15 min interval  
First Id repeated once between 10 and 10:15, second Id repeated once between 10 and 10:15, and second time between 10:10 and 10:25, if we had considered fixed interval instead of sliding window, then we will get 2 different counts with 1 each between 10 to 10:15 and 10:15 and 10:30, and user id 3 didn't repeat in any 15 min interval window, so it's 0

---

<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 7, 2023, 12:27pm UTC](https://discuss.elastic.co/t/sliding-window-query-in-elastic/344733/2 "2023-11-07T12:27:06Z")

</div>

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