# What is My fail

**URL:** <https://discuss.elastic.co/t/what-is-my-fail/135137>\
**Category:** Elasticsearch\
**Created:** [June 8, 2018, 11:10am UTC](https://discuss.elastic.co/t/what-is-my-fail/135137 "2018-06-08T11:10:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![firattaskin93](https://avatars.discourse-cdn.com/v4/letter/f/9fc29f/32.png) [@firattaskin93](https://discuss.elastic.co/u/firattaskin93)\
**Post date:** [June 8, 2018, 11:10am UTC](https://discuss.elastic.co/t/what-is-my-fail/135137/1 "2018-06-08T11:10:57Z")

</div>

Hi Everyone,  
My problem is about filter and get terms.  
İ wanna get term counts like [zalando.de](http://zalando.de)  
When i clicked any color other colors not seeing after refresh.  
I could not found any example for nested products and filters.

// My index  
PUT products  
{  
"mappings": {  
"product": {  
"properties": {  
"name": { "type": "text" },  
"permalink": { "type": "text" },  
"images": {"type" : "text"},  
"variations": {  
"type": "nested",  
"properties": {  
"size": { "type": "keyword" },  
"color": { "type": "keyword" },  
"brand": { "type": "keyword" },  
"brand-slug": { "type": "keyword" },  
"price": {"type": "double" },  
"sale\_price": {"type": "double" },  
"stock": {"type": "integer" }  
}  
},  
"categories": {  
"type": "nested",  
"properties": {  
"id": { "type": "integer" },  
"name": { "type": "keyword" },  
"slug": { "type": "keyword" }  
}  
}  
}  
}  
}  
}

* * *

//My search code with Aggretions  
{  
"from": 0,  
"size": 12,  
"aggs": {  
"nested\_colors": {  
"nested": {  
"path": "variations"  
},  
"aggs": {  
"colors": {  
"terms": {  
"field": "variations.color"  
},  
"aggs": {  
"reverse\_nested\_colors": {  
"reverse\_nested": {}  
}  
}  
}  
}  
},  
"nested\_sizes": {  
"nested": {  
"path": "variations"  
},  
"aggs": {  
"sizes": {  
"terms": {  
"field": "variations.size"  
},  
"aggs": {  
"reverse\_nested\_sizes": {  
"reverse\_nested": {}  
}  
}  
}  
}  
},  
"nested\_categories": {  
"nested": {  
"path": "categories"  
},  
"aggs": {  
"colors": {  
"terms": {  
"field": "categories.name"  
},  
"aggs": {  
"reverse\_nested\_categories": {  
"reverse\_nested": {}  
}  
}  
}  
}  
},  
"nested\_markes": {  
"nested": {  
"path": "variations"  
},  
"aggs": {  
"markes": {  
"terms": {  
"field": "variations.brand-slug"  
},  
"aggs": {  
"reverse\_nested\_markes": {  
"reverse\_nested": {}  
}  
}  
}  
}  
}  
},  
"query": {  
"bool": {  
"must": [  
{  
"nested": {  
"query": {  
"bool": {  
"must": [  
{  
"term": {  
"variations.color": "Blau"  
}  
},  
{  
"term": {  
"variations.size": "W30/L32"  
}  
},  
{  
"term": {  
"variations.brand-slug": "yazubi"  
}  
}  
]  
}  
},  
"path": "variations"  
}  
},  
{  
"nested": {  
"query": {  
"bool": {  
"must": [  
{  
"match": {  
"categories.slug": "herren"  
}  
}  
]  
}  
},  
"path": "categories"  
}  
}  
]  
}  
}  
}

---

<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, 2018, 11:10am UTC](https://discuss.elastic.co/t/what-is-my-fail/135137/2 "2018-07-06T11:10:59Z")

</div>

Closed on July 6, 2018, 11:10am UTC

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