# Search query issue

**URL:** <https://discuss.elastic.co/t/search-query-issue/135165>\
**Category:** Elasticsearch\
**Created:** [June 8, 2018, 1:45pm UTC](https://discuss.elastic.co/t/search-query-issue/135165 "2018-06-08T13:45:47Z")\
**Posts on this page:** 4\
**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, 1:45pm UTC](https://discuss.elastic.co/t/search-query-issue/135165/1 "2018-06-08T13:45:47Z")

</div>

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

```auto
// 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

```auto
{
  "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:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [June 8, 2018, 4:11pm UTC](https://discuss.elastic.co/t/search-query-issue/135165/2 "2018-06-08T16:11:09Z")

</div>

Could you change the title to something more meaningful please?

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [June 10, 2018, 3:42am UTC](https://discuss.elastic.co/t/search-query-issue/135165/3 "2018-06-10T03:42:01Z")

</div>

Please don't post the same question more than once, it makes it harder for people to assist.

> [@What is My fail](https://discuss.elastic.co/t/what-is-my-fail/135137):
>
> 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": …

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [June 10, 2018, 3:42am UTC](https://discuss.elastic.co/t/search-query-issue/135165/4 "2018-06-10T03:42:05Z")

</div>

Closed on June 10, 2018, 3:42am UTC


