# Query\_string search within nested types

**URL:** <https://discuss.elastic.co/t/query-string-search-within-nested-types/320218>\
**Category:** Elasticsearch\
**Created:** [December 1, 2022, 7:26am UTC](https://discuss.elastic.co/t/query-string-search-within-nested-types/320218 "2022-12-01T07:26:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![vlasami](https://avatars.discourse-cdn.com/v4/letter/v/ad7895/32.png) [@vlasami](https://discuss.elastic.co/u/vlasami)\
**Post date:** [December 1, 2022, 7:26am UTC](https://discuss.elastic.co/t/query-string-search-within-nested-types/320218/1 "2022-12-01T07:26:47Z")

</div>

Hi,

We recently introduced nested type to our document structure and found that it has some restriction with the query\_string search type, which we use extensively.

The search documentation says that:

"Avoid using the `query_string` query for nested documents  
`query_string` searches do not return nested documents. To search nested documents, use the `nested` query."

But, is it ok to use "query\_string" inside the "nested" query ?

So something like:

```auto
{
  "query": {
   "nested": {
      "path": "nestedfield",
      "query": {
        "bool": {
           "should": [{
              "query_string": {
                  "query": "(textA OR textB)"        
                }
	   }]
    }
  }
}

```

Thanks in advance !

---

<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 29, 2022, 7:26am UTC](https://discuss.elastic.co/t/query-string-search-within-nested-types/320218/2 "2022-12-29T07:26:58Z")

</div>

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