# Nested query without knowing the path

**URL:** <https://discuss.elastic.co/t/nested-query-without-knowing-the-path/187550>\
**Category:** Elasticsearch\
**Created:** [June 26, 2019, 10:55am UTC](https://discuss.elastic.co/t/nested-query-without-knowing-the-path/187550 "2019-06-26T10:55:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![muthualagappan](https://avatars.discourse-cdn.com/v4/letter/m/b5e925/32.png) [@muthualagappan](https://discuss.elastic.co/u/muthualagappan)\
**Post date:** [June 26, 2019, 10:55am UTC](https://discuss.elastic.co/t/nested-query-without-knowing-the-path/187550/1 "2019-06-26T10:55:32Z")

</div>

How to query the nested objects without knowing the nested path? In our example there are multiple nested levels and the query should be executed on all the nested paths.

The below example works as the path is specified. I want the fields to be verified on all the nested paths. Can I use some kind of wildcard for path like "path": "\*"?

curl -X GET "localhost:9200/\_search?pretty=true" -H 'Content-Type: application/json' -d'  
{  
"query": {  
"nested": {  
_"path": "user",_  
"query": {  
"bool": {  
"must": [  
{"multi\_match":{"query":"Alice","fields":["_.first"]}},  
{"multi\_match":{"query":"White","fields":["_.last"]}}  
]  
}  
}  
}  
}  
}'

---

<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:** [July 24, 2019, 10:55am UTC](https://discuss.elastic.co/t/nested-query-without-knowing-the-path/187550/2 "2019-07-24T10:55:37Z")

</div>

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