# Help with nested type

**URL:** <https://discuss.elastic.co/t/help-with-nested-type/7796>\
**Category:** Elasticsearch\
**Created:** [May 22, 2012, 12:18am UTC](https://discuss.elastic.co/t/help-with-nested-type/7796 "2012-05-22T00:18:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mohit\_Anchlia](https://avatars.discourse-cdn.com/v4/letter/m/848f3c/32.png) [@Mohit\_Anchlia](https://discuss.elastic.co/u/Mohit_Anchlia)\
**Post date:** [May 22, 2012, 12:18am UTC](https://discuss.elastic.co/t/help-with-nested-type/7796/1 "2012-05-22T00:18:18Z")

</div>

I am trying to do nested type search. I have 2 documents and mapping listed  
below. But it doesn't seem to work. Am I querying it correctly?

Query that failes with no handler found. If I do two/one/\_search then it  
says "nested" element not found. Not sure how to query it. Could someone  
help?

Query:

curl -XGET '[http://dslg1:9200/two/\_search](http://dslg1:9200/two/_search)' -d '{  
"nested" : {  
"path" : "one",  
"score\_mode" : "avg",  
"query" : {  
"bool" : {  
"must" : [  
{  
"text" : {"attributes.name" : "age"}  
},  
{  
"text" : {"attributes.value" : "3"}  
},  
]  
}  
}  
}  
}'

Mapping:

curl -XPOST '[http://dslg1:9200/two/](http://dslg1:9200/two/)' -d '{  
"mappings" : {  
"one" : {  
"properties" : {  
"attributes" : {  
"type" : "nested"  
}  
}  
}  
}  
}'

doc 1

{ "attributes" : [  
{ "base64" : true,  
"encrypted" : true,  
"name" : "ssn",  
"value" : "EAAgfyaxpzdfcfv9Qexq1WtGvA=="  
},  
{ "base64" : false,  
"encrypted" : false,  
"name" : "deviceId",  
"value" : "aass11234aaaxxxCC"  
},  
{ "base64" : false,  
"encrypted" : false,  
"name" : "age",  
"value" : "1"  
}  
],  
}

doc 2

{ "attributes" : [  
{ "base64" : true,  
"encrypted" : true,  
"name" : "ssn",  
"value" : "EAAgfyaxpzdfcfv9Qexq1WtGvA=="  
},  
{ "base64" : false,  
"encrypted" : false,  
"name" : "deviceId",  
"value" : "aass11234aaaxxxCC"  
},  
{ "base64" : false,  
"encrypted" : false,  
"name" : "age",  
"value" : "2"  
}  
],  
"version" : 1337298622093  
}

---

<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:27am UTC](https://discuss.elastic.co/t/help-with-nested-type/7796/2 "2017-07-06T03:27:44Z")

</div>


