# Search in all paths in a nested query

**URL:** <https://discuss.elastic.co/t/search-in-all-paths-in-a-nested-query/94989>\
**Category:** Elasticsearch\
**Created:** [July 28, 2017, 4:51pm UTC](https://discuss.elastic.co/t/search-in-all-paths-in-a-nested-query/94989 "2017-07-28T16:51:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![hanisaf](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hanisaf/32/20571_2.png) [@hanisaf](https://discuss.elastic.co/u/hanisaf)\
**Post date:** [July 28, 2017, 4:51pm UTC](https://discuss.elastic.co/t/search-in-all-paths-in-a-nested-query/94989/1 "2017-07-28T16:51:53Z")

</div>

I have a document that contains multiple nested fields. I want to write a generic query to match a keyword in all nested fields and return inner hits. Is there a way to use **\_all** in path and/or fields. i.e to write something like:

```
GET mydocs/_search
{
  "query": {
    "nested": {
      "path": "_all",
      "query": {
        "bool": {
          "must": [
            { "match": { "_all": "keyword" }}
          ]
        }
      },
      "inner_hits": { 
        "highlight": {
          "fields": {
            "_all": {}
          }
        }
      }
    }
  }
}
```

---

<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:** [August 25, 2017, 4:52pm UTC](https://discuss.elastic.co/t/search-in-all-paths-in-a-nested-query/94989/2 "2017-08-25T16:52:21Z")

</div>

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