# Queries are very slow

**URL:** <https://discuss.elastic.co/t/queries-are-very-slow/173365>\
**Category:** Elasticsearch\
**Created:** [March 21, 2019, 5:40pm UTC](https://discuss.elastic.co/t/queries-are-very-slow/173365 "2019-03-21T17:40:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sashi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sashi/32/54966_2.png) [@Sashi](https://discuss.elastic.co/u/Sashi)\
**Post date:** [March 21, 2019, 5:40pm UTC](https://discuss.elastic.co/t/queries-are-very-slow/173365/1 "2019-03-21T17:40:19Z")

</div>

I have this query which took 38 seconds to execute.  
{  
"size": 10000,  
"timeout": "30089ms",  
"query": {  
"constant\_score": {  
"filter": {  
"bool": {  
"must": [{  
"terms": {  
"detail.status": ["ACTIVE"],  
"boost": 1.0  
}  
}, {  
"terms": {  
"partner\_id": [585],  
"boost": 1.0  
}  
}],  
"filter": [{  
"terms": {  
"location\_id": [1774375, 1774233, 4197510, 1773807, 1884914, 1773626, 1774004, 1774349, 1773494, 1773948, 1774401, 1773791, 1773484, 1773442, 1774209, 1774021, 1773483, 1773702, 2781703, 8809917],  
"boost": 1.0  
}  
}],  
"adjust\_pure\_negative": true,  
"boost": 1.0  
}  
},  
"boost": 1.0  
}  
},  
"sort": [{  
"review\_date": {  
"order": "desc",  
"missing": "\_last"  
}  
}]  
}

All the queries with size 10000 will take some time but this took way too much longer.  
Any suggestions on improving this query please

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [March 21, 2019, 6:36pm UTC](https://discuss.elastic.co/t/queries-are-very-slow/173365/2 "2019-03-21T18:36:32Z")

</div>

Can you share the response?  
Just remove the 9999 hits and only keep one.  
But run it with `size:10000`.

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 18, 2019, 6:36pm UTC](https://discuss.elastic.co/t/queries-are-very-slow/173365/3 "2019-04-18T18:36:32Z")

</div>

Closed on April 18, 2019, 6:36pm UTC

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