# Elastic search query timing out after 10 minutes

**URL:** <https://discuss.elastic.co/t/elastic-search-query-timing-out-after-10-minutes/41057>\
**Category:** Elasticsearch\
**Created:** [February 5, 2016, 12:33pm UTC](https://discuss.elastic.co/t/elastic-search-query-timing-out-after-10-minutes/41057 "2016-02-05T12:33:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bmcalindin](https://avatars.discourse-cdn.com/v4/letter/b/ba9def/32.png) [@bmcalindin](https://discuss.elastic.co/u/bmcalindin)\
**Post date:** [February 5, 2016, 12:33pm UTC](https://discuss.elastic.co/t/elastic-search-query-timing-out-after-10-minutes/41057/1 "2016-02-05T12:33:10Z")

</div>

Hey,

I'm having an issue with my query timing out after 10 minutes over a large dataset and was wondering if anyone could lend a hand.

My dataset is about 700 million rows for 3 years of data (~75GB of primary shards). My data is sharded by month with 1 primary shard and 1 replica giving indices of ~2GB. When I query I choose only the shards for the relevant months.

My query (posted below) involves two filters on integers and 3 aggregations; one on an unanalysed string, one on a date, and one on an integer (that was previously filtered on). I am running my queries using the elasticsearch python dsl.

One thing that I am currently trying is to reindex my data into 6 month indices which will give indices of ~15GB. I'm just waiting for the reindex to finish.

Elasticsearch version 2.1.1

This is an example query:

{  
'query': {  
'filtered': {  
'filter': {  
'bool': {  
'must': [{  
'term': {  
'usergroup\_id': u '8369'  
}  
}, {  
'range': {  
'timeOf': {  
'gte': '2016-01-01'  
}  
}  
}, {  
'range': {  
'timeOf': {  
'lte': '2016-01-31'  
}  
}  
}, {  
'or': {  
'filters': [{  
'term': {  
'event\_type': 4  
}  
}, {  
'term': {  
'event\_type': 5  
}  
}, {  
'term': {  
'event\_type': 6  
}  
}]  
}  
}]  
}  
},  
'query': {  
'match\_all': {}  
}  
}  
},  
'aggs': {  
'per\_individual\_user': {  
'terms': {  
'field': 'sso\_user\_id',  
'size': 0  
},  
'aggs': {  
'per\_date\_interval': {  
'date\_histogram': {  
'extended\_bounds': {  
'max': '2016-01-31',  
'min': '2016-01-01'  
},  
'min\_doc\_count': 0,  
'interval': u 'month', # We use various date groupings  
'field': 'timeOf',  
'order': {  
'\_key': 'asc'  
}  
},  
'aggs': {  
'per\_event\_type': {  
'terms': {  
'field': 'event\_type',  
'min\_doc\_count': 0  
},  
'aggs': {  
'usage\_sum': {  
'sum': {  
'field': 'duration'  
}  
},  
'usage\_count': {  
'value\_count': {  
'field': 'event\_type'  
}  
}  
}  
}  
}  
}  
}  
}  
}  
}

---

<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:** [July 5, 2017, 11:18pm UTC](https://discuss.elastic.co/t/elastic-search-query-timing-out-after-10-minutes/41057/2 "2017-07-05T23:18:34Z")

</div>


