Skip to content

Commit

Permalink
Support hard bounds in HistogramAggregation (#2457)
Browse files Browse the repository at this point in the history
  • Loading branch information
KadekM authored Jul 27, 2021
1 parent 0cccc89 commit bc337bb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ case class HistogramAggregation(name: String,
keyed: Option[Boolean] = None,
offset: Option[Double] = None,
extendedBounds: Option[ExtendedBounds] = None,
hardBounds: Option[ExtendedBounds] = None,
order: Option[HistogramOrder] = None,
script: Option[Script] = None,
subaggs: Seq[AbstractAggregation] = Nil,
Expand All @@ -36,4 +37,6 @@ case class HistogramAggregation(name: String,
def offset(offset: Double): HistogramAggregation = copy(offset = offset.some)
def extendedBounds(min: Double, max: Double): HistogramAggregation =
copy(extendedBounds = ExtendedBounds(min, max).some)
def hardBounds(min: Double, max: Double): HistogramAggregation =
copy(hardBounds = ExtendedBounds(min, max).some)
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ object HistogramAggregationBuilder {
agg.extendedBounds.foreach { bounds =>
builder.rawField("extended_bounds", ExtendedBoundsBuilderFn(bounds))
}
agg.hardBounds.foreach { bounds =>
builder.rawField("hard_bounds", ExtendedBoundsBuilderFn(bounds))
}
builder.endObject()

SubAggsBuilderFn(agg, builder)
Expand Down

0 comments on commit bc337bb

Please sign in to comment.