# Elasticsearch nested query

**URL:** <https://discuss.elastic.co/t/elasticsearch-nested-query/9159>\
**Category:** Elasticsearch\
**Created:** [September 26, 2012, 2:28pm UTC](https://discuss.elastic.co/t/elasticsearch-nested-query/9159 "2012-09-26T14:28:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![shanmuga](https://avatars.discourse-cdn.com/v4/letter/s/edb3f5/32.png) [@shanmuga](https://discuss.elastic.co/u/shanmuga)\
**Post date:** [September 26, 2012, 2:28pm UTC](https://discuss.elastic.co/t/elasticsearch-nested-query/9159/1 "2012-09-26T14:28:13Z")

</div>

**This is my 'nested search' query:**

**Following page :** https://gist.github.com/2152146

{  
"query": {  
"nested": {  
"\_scope": "my\_scope",  
"path": "stores",  
"score\_mode": "avg",  
"query": {  
"filtered" : {  
"query" : {  
"match\_all": {}  
},  
"filter" : {  
"term" : { "stores.id" : "1001" }  
}  
}  
}  
}  
},  
"facets" : {  
"range1" : {  
"range" : {  
"stores.price" : [  
{ "to" : 200.0 },  
{ "from" : 200.0, "to" : 500.0 },  
{ "from" : 500.1, "to" : 700.0 },  
{ "from" : 700, "to" : 900.0 },  
{ "from" : 900, "to" : 1000.0 },  
{ "from" : 1000.0 }  
]  
},  
"scope": "my\_scope"  
}  
}  
}

**My Exception :**

"error" : "SearchPhaseExecutionException[Failed to execute phase [query], total failure; shardFailures {[zxSIYLK\_TXyB5eBJ-SZQag][test][0]: SearchParseException[[test][0]: from[-1],size[-1]: Parse Failure [Failed to parse source [{\r\n "query": {\r\n ....}}}}}].

 How can I solve this problem?

---

<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 6, 2017, 3:11am UTC](https://discuss.elastic.co/t/elasticsearch-nested-query/9159/2 "2017-07-06T03:11:17Z")

</div>


