# ElasticSearch Symfony : Tree Category

**URL:** https://discuss.elastic.co/t/elasticsearch-symfony-tree-category/57246
**Category:** Elasticsearch
**Created:** [August 4, 2016, 3:56pm UTC](https://discuss.elastic.co/t/elasticsearch-symfony-tree-category/57246 "2016-08-04T15:56:27Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Mestophsi](https://avatars.discourse-cdn.com/v4/letter/m/e47c2d/32.png) [@Mestophsi](https://discuss.elastic.co/u/Mestophsi)
#### Post date: [August 4, 2016, 3:56pm UTC](https://discuss.elastic.co/t/elasticsearch-symfony-tree-category/57246/1 "2016-08-04T15:56:27Z")

</div>

Hello,

I have entity book, in this entity i have association with category. In my entity category i can get parent with method. In my mapping (config.yml) i have this :

book:  
mappings:  
name: ~  
bookCategory: { type: 'object', properties: { id : {type: 'integer'}, name: {type: 'string', index: 'not\_analyzed'}, parent: {type: 'object', properties: {name: {type: 'string', index: 'not\_analyzed'}, parent: {type: 'object', properties: {name: {type: 'string', index: 'not\_analyzed'}}}}} } }  
persistence:  
driver: 'orm'  
model: 'AppBundle\Entity\Book\Book'  
provider:  
batch\_size: 5000  
listener: ~  
finder: ~

I get my categories but separately.

category : [key,count]  
subCategory: [key, count]  
subsubCategory: [key, count]

i need this :

category : [key, count, subCategory [key, count, subsubCategory [ key, count]]]

Thanks,  
Sorry for my bad english

---

<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 5, 2017, 10:30pm UTC](https://discuss.elastic.co/t/elasticsearch-symfony-tree-category/57246/2 "2017-07-05T22:30:02Z")

</div>


