# How to make a nested term query

**URL:** <https://discuss.elastic.co/t/how-to-make-a-nested-term-query/288506>\
**Category:** Elasticsearch\
**Created:** [November 5, 2021, 2:58pm UTC](https://discuss.elastic.co/t/how-to-make-a-nested-term-query/288506 "2021-11-05T14:58:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Araf\_Shihab](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/araf_shihab/32/96757_2.png) [@Araf\_Shihab](https://discuss.elastic.co/u/Araf_Shihab)\
**Post date:** [November 5, 2021, 2:58pm UTC](https://discuss.elastic.co/t/how-to-make-a-nested-term-query/288506/1 "2021-11-05T14:58:59Z")

</div>

Hey Elasticsearch community. I have a nested query as such

```auto
{
    "size": 20,
    "_source": ["tags"],
	"sort": [
		{ "@timestamp": { "order": "desc" } }
	],
    "query": {
        "nested" : {
            "path" : "tags",
                "query" : {
                    "bool" : {
                        "must" : [
                          { "match_phrase" : {"tags.name" : "thriller"} }
                        ]    
                }
            }
        }
    }
}

```

How do I transform this query into a term query?

---

<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:** [December 3, 2021, 2:59pm UTC](https://discuss.elastic.co/t/how-to-make-a-nested-term-query/288506/2 "2021-12-03T14:59:44Z")

</div>

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