# Save a query and use it by the name

**URL:** <https://discuss.elastic.co/t/save-a-query-and-use-it-by-the-name/121814>\
**Category:** Elasticsearch\
**Created:** [February 28, 2018, 9:29am UTC](https://discuss.elastic.co/t/save-a-query-and-use-it-by-the-name/121814 "2018-02-28T09:29:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![devil\_srj7](https://avatars.discourse-cdn.com/v4/letter/d/8edcca/32.png) [@devil\_srj7](https://discuss.elastic.co/u/devil_srj7)\
**Post date:** [February 28, 2018, 9:29am UTC](https://discuss.elastic.co/t/save-a-query-and-use-it-by-the-name/121814/1 "2018-02-28T09:29:47Z")

</div>

I have a query that is repeatedly used.  
Is there a way such that I can save the entire query and refer it by using the name which I can give while storing?

---

<div class="post-metadata">

**Author:** ![mjunaidmuzammil](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mjunaidmuzammil/32/56910_2.png) [@mjunaidmuzammil](https://discuss.elastic.co/u/mjunaidmuzammil)\
**Post date:** [February 28, 2018, 10:45am UTC](https://discuss.elastic.co/t/save-a-query-and-use-it-by-the-name/121814/2 "2018-02-28T10:45:00Z")

</div>

I guess the script query can be somewhat useful for your case. You can find more details about it at below link.

[https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-script-query.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-script-query.html)

---

<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:** [March 28, 2018, 10:45am UTC](https://discuss.elastic.co/t/save-a-query-and-use-it-by-the-name/121814/3 "2018-03-28T10:45:21Z")

</div>

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