# Elasticsearch Python Cache

**URL:** <https://discuss.elastic.co/t/elasticsearch-python-cache/259246>\
**Category:** Elasticsearch\
**Created:** [December 21, 2020, 11:52am UTC](https://discuss.elastic.co/t/elasticsearch-python-cache/259246 "2020-12-21T11:52:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![satyamsinghal575](https://avatars.discourse-cdn.com/v4/letter/s/ea666f/32.png) [@satyamsinghal575](https://discuss.elastic.co/u/satyamsinghal575)\
**Post date:** [December 21, 2020, 11:52am UTC](https://discuss.elastic.co/t/elasticsearch-python-cache/259246/1 "2020-12-21T11:52:05Z")

</div>

I am using elasticsearch primarily for aggregations, then eventually i came across setting the query size to zero, according to my understanding this helps in two ways :

1. payload size is reduced
2. and when we use query in filter context with size set to zero, elasticsearch internally caches the results .

I use python client to query my cluster. my doubt is,  
will setting size=0 in es.search(index=index, body=query, size=0) automatically override the json query and enable cache

---

<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:** [January 18, 2021, 11:52am UTC](https://discuss.elastic.co/t/elasticsearch-python-cache/259246/2 "2021-01-18T11:52:15Z")

</div>

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