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

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

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.

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

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