# Accessing properties of child objects

**URL:** <https://discuss.elastic.co/t/accessing-properties-of-child-objects/12196>\
**Category:** Elasticsearch\
**Created:** [May 30, 2013, 9:31pm UTC](https://discuss.elastic.co/t/accessing-properties-of-child-objects/12196 "2013-05-30T21:31:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dantuff](https://avatars.discourse-cdn.com/v4/letter/d/e79b87/32.png) [@dantuff](https://discuss.elastic.co/u/dantuff)\
**Post date:** [May 30, 2013, 9:31pm UTC](https://discuss.elastic.co/t/accessing-properties-of-child-objects/12196/1 "2013-05-30T21:31:33Z")

</div>

If my data is in following format

"myContent":{  
"product":{  
"name":"test",  
"date":"2013",  
"features":{  
"non-functional":{  
"type": "hardware",  
},  
"functional":{  
"name":"search"  
}  
}  
}  
}

How can apply a analyzer to the non-funtional 'type' in my mapping, and  
them use that 'type' as filter query in my searches. I'm not clear on how  
to access properties of child objects.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![dantuff](https://avatars.discourse-cdn.com/v4/letter/d/e79b87/32.png) [@dantuff](https://discuss.elastic.co/u/dantuff)\
**Post date:** [May 31, 2013, 8:20am UTC](https://discuss.elastic.co/t/accessing-properties-of-child-objects/12196/2 "2013-05-31T08:20:35Z")

</div>

If i want to use type as a filter query can i reference it using  
'product.features.non-functional.type' as the field property?

On Thursday, May 30, 2013 10:31:33 PM UTC+1, es newbie wrote:

> If my data is in following format
> 
> "myContent":{  
> "product":{  
> "name":"test",  
> "date":"2013",  
> "features":{  
> "non-functional":{  
> "type": "hardware",  
> },  
> "functional":{  
> "name":"search"  
> }  
> }  
> }  
> }
> 
> How can apply a analyzer to the non-funtional 'type' in my mapping, and  
> them use that 'type' as filter query in my searches. I'm not clear on how  
> to access properties of child objects.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![mvg](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mvg/32/98890_2.png) [@mvg](https://discuss.elastic.co/u/mvg)\
**Post date:** [June 5, 2013, 3:29pm UTC](https://discuss.elastic.co/t/accessing-properties-of-child-objects/12196/3 "2013-06-05T15:29:28Z")

</div>

If you provide this document like this to elasticsearch:  
curl -XPUT 'localhost:9200/my\_index/context/1' -d '{  
"myContent":{  
"product":{  
"name":"test",  
"date":"2013",  
"features":{  
"non-functional":{  
"type": "hardware"  
},  
"functional":{  
"name":"search"  
}  
}  
}  
}  
}'

Do a refesh (Happens automatically every second by default, but just  
showing it to complete the example):  
curl -XGET 'localhost:9200/my\_index/\_refresh'

And then search with a filtered query like this:  
curl -XGET 'localhost:9200/my\_index/\_search' -d '{  
"query" : {  
"filtered" : {  
"filter" : {  
"term" : {"myContent.product.features.non-functional.type" :  
"hardware"}  
}  
}  
}  
}'

The search result should include the previous index document.

Martijn

On 31 May 2013 10:20, es newbie [dan.tuffery@gmail.com](mailto:dan.tuffery@gmail.com) wrote:

> If i want to use type as a filter query can i reference it using  
> 'product.features.non-functional.type' as the field property?
> 
> On Thursday, May 30, 2013 10:31:33 PM UTC+1, es newbie wrote:
> 
> > If my data is in following format
> > 
> > "myContent":{  
> > "product":{  
> > "name":"test",  
> > "date":"2013",  
> > "features":{  
> > "non-functional":{  
> > "type": "hardware",  
> > },  
> > "functional":{  
> > "name":"search"  
> > }  
> > }  
> > }  
> > }
> > 
> > How can apply a analyzer to the non-funtional 'type' in my mapping, and  
> > them use that 'type' as filter query in my searches. I'm not clear on how  
> > to access properties of child objects.
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
Met vriendelijke groet,

Martijn van Groningen

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:32am UTC](https://discuss.elastic.co/t/accessing-properties-of-child-objects/12196/4 "2017-07-06T02:32:45Z")

</div>


