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