# Persisting or Caching query results for future retrieval speed up

**URL:** <https://discuss.elastic.co/t/persisting-or-caching-query-results-for-future-retrieval-speed-up/135552>\
**Category:** Elasticsearch\
**Created:** [June 12, 2018, 2:11pm UTC](https://discuss.elastic.co/t/persisting-or-caching-query-results-for-future-retrieval-speed-up/135552 "2018-06-12T14:11:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dfhg](https://avatars.discourse-cdn.com/v4/letter/d/7feea3/32.png) [@dfhg](https://discuss.elastic.co/u/dfhg)\
**Post date:** [June 12, 2018, 2:11pm UTC](https://discuss.elastic.co/t/persisting-or-caching-query-results-for-future-retrieval-speed-up/135552/1 "2018-06-12T14:11:27Z")

</div>

Hello,

Is it possible to launch a query "X", and have the results persisted/cached/saved so that I may write a new query "Y" with definition (query X AND filter Z) so that it uses the results from query X to speed up the retrieval?

I am aware of reindex API, but this duplicates the data. I was hoping for a lighter/more elegant solution.

---

<div class="post-metadata">

**Author:** ![Bapa86](https://avatars.discourse-cdn.com/v4/letter/b/a587f6/32.png) [@Bapa86](https://discuss.elastic.co/u/Bapa86)\
**Post date:** [June 14, 2018, 1:58pm UTC](https://discuss.elastic.co/t/persisting-or-caching-query-results-for-future-retrieval-speed-up/135552/2 "2018-06-14T13:58:26Z")

</div>

We were considering doing this because we have hierarchical relationships between our documents and we were looking to find a way to "store" higher-level documents for which the queries matched the lower-level documents. The idea is to then use the higher-level documents that were the result of the first query as a filter for further queries.

If anyone has any suggestions, we would greatly appreciate it.

---

<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 12, 2018, 1:58pm UTC](https://discuss.elastic.co/t/persisting-or-caching-query-results-for-future-retrieval-speed-up/135552/3 "2018-07-12T13:58:27Z")

</div>

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