[source, ruby]
----
response = client.search(
  body: {
    size: 0,
    aggregations: {
      my_buckets: {
        composite: {
          sources: [
            {
              user_name: {
                terms: {
                  field: 'user_name'
                }
              }
            },
            {
              date: {
                date_histogram: {
                  field: 'timestamp',
                  calendar_interval: '1d',
                  order: 'desc'
                }
              }
            }
          ]
        }
      }
    }
  }
)
puts response
----
