[source, ruby]
----
response = client.search(
  index: 'sales',
  size: 0,
  body: {
    query: {
      constant_score: {
        filter: {
          range: {
            price: {
              to: '500'
            }
          }
        }
      }
    },
    aggregations: {
      prices: {
        histogram: {
          field: 'price',
          interval: 50,
          hard_bounds: {
            min: 100,
            max: 200
          }
        }
      }
    }
  }
)
puts response
----
