# Https://discuss.elastic.co/t/search-buckets-aggregations-return-empty/92318

**URL:** <https://discuss.elastic.co/t/https-discuss-elastic-co-t-search-buckets-aggregations-return-empty-92318/92518>\
**Category:** Elasticsearch\
**Created:** [July 10, 2017, 7:21pm UTC](https://discuss.elastic.co/t/https-discuss-elastic-co-t-search-buckets-aggregations-return-empty-92318/92518 "2017-07-10T19:21:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Paulo\_Lelis](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/paulo_lelis/32/19861_2.png) [@Paulo\_Lelis](https://discuss.elastic.co/u/Paulo_Lelis)\
**Post date:** [July 10, 2017, 7:21pm UTC](https://discuss.elastic.co/t/https-discuss-elastic-co-t-search-buckets-aggregations-return-empty-92318/92518/1 "2017-07-10T19:21:38Z")

</div>

```
query: {
  query_string: {
    query: 'type: message',
    analyze_wildcard: true
  }
},
size: 1000,
_source: {
  excludes: []
},
aggs: {
  user: {
    terms: {
      field: 'content.username.keyword',
      size: 1000,
      order: {
        _count: 'desc'
      }
    },
    aggs: {
      channel: {
        terms: {
          field: 'channelId.keyword',
          size: 1,
          order: {
            _term: 'desc'
          }
        },
        aggs: {
          messages: {
            terms: {
              field: 'content.message.keyword',
              size: 5,
              order: {
                _count: 'desc'
              }
            },
            aggs: {
              sentiment: {
                terms: {
                  field: 'sentimentScore',
                  size: 5,
                  order: {
                    _term: 'desc'
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}

```

This query return aggregations empty even with 117 hits

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [July 11, 2017, 9:30am UTC](https://discuss.elastic.co/t/https-discuss-elastic-co-t-search-buckets-aggregations-return-empty-92318/92518/2 "2017-07-11T09:30:18Z")

</div>

please take your time to write a proper topic and take even more time to write about your problem in details. How about your mapping? how about your data? Can you create a minimal example, so others could follow your steps?

This way of writing makes it almost impossible to come up with anything helpful.

---

<div class="post-metadata">

**Author:** ![Paulo\_Lelis](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/paulo_lelis/32/19861_2.png) [@Paulo\_Lelis](https://discuss.elastic.co/u/Paulo_Lelis)\
**Post date:** [July 17, 2017, 8:22pm UTC](https://discuss.elastic.co/t/https-discuss-elastic-co-t-search-buckets-aggregations-return-empty-92318/92518/3 "2017-07-17T20:22:16Z")

</div>

My only problem is that I run this query with 'sentimentScore:1' to 'sentimentScore:10' its ok return the buckets but when i try with 0 it doesnt return any data in the buckets but the hits return

---

<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:** [August 14, 2017, 8:22pm UTC](https://discuss.elastic.co/t/https-discuss-elastic-co-t-search-buckets-aggregations-return-empty-92318/92518/4 "2017-08-14T20:22:49Z")

</div>

Closed on August 14, 2017, 8:22pm UTC

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