# GET, and then QUERY

**URL:** <https://discuss.elastic.co/t/get-and-then-query/168479>\
**Category:** Elasticsearch\
**Created:** [February 14, 2019, 7:30pm UTC](https://discuss.elastic.co/t/get-and-then-query/168479 "2019-02-14T19:30:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jarraga](https://avatars.discourse-cdn.com/v4/letter/j/d78d45/32.png) [@jarraga](https://discuss.elastic.co/u/jarraga)\
**Post date:** [February 14, 2019, 7:30pm UTC](https://discuss.elastic.co/t/get-and-then-query/168479/1 "2019-02-14T19:30:48Z")

</div>

Hi! It's possible make a GET, to retrieve an document, and then make a query using some of the fields in this document like as match values? Is to say, make nested query in elasticsearch side, to improve the time to query?

---

<div class="post-metadata">

**Author:** ![gbrown](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gbrown/32/34482_2.png) [@gbrown](https://discuss.elastic.co/u/gbrown)\
**Post date:** [February 15, 2019, 1:04am UTC](https://discuss.elastic.co/t/get-and-then-query/168479/2 "2019-02-15T01:04:29Z")

</div>

Hi! It's possible to do this, with some limitations, using a [terms lookup query](https://www.elastic.co/guide/en/elasticsearch/reference/6.6/query-dsl-terms-query.html#query-dsl-terms-lookup). Specifically, you'll need to know the `_id` of the document you're getting the values from (that is, you would otherwise do `GET /my_index/_doc/47` rather than a search), and it only works with `terms` queries.

---

<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 15, 2019, 1:04am UTC](https://discuss.elastic.co/t/get-and-then-query/168479/3 "2019-03-15T01:04:32Z")

</div>

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