Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ setup:

---
"basic":
- skip:
version: " - 7.99.99"
reason: BWC test failures https://github.com/elastic/elasticsearch/issues/54396 && waiting for backport https://github.com/elastic/elasticsearch/pull/54379
- do:
search:
body:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,20 +110,6 @@ static RoundingInfo[] buildRoundings(ZoneId timeZone, String minimumInterval) {

private String minimumIntervalExpression;

public String getMinimumIntervalExpression() {
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm moving these below the ctor to make me feel better.

return minimumIntervalExpression;
}

public AutoDateHistogramAggregationBuilder setMinimumIntervalExpression(String minimumIntervalExpression) {
if (minimumIntervalExpression != null && !ALLOWED_INTERVALS.containsValue(minimumIntervalExpression)) {
throw new IllegalArgumentException(MINIMUM_INTERVAL_FIELD.getPreferredName() +
" must be one of [" + ALLOWED_INTERVALS.values().toString() + "]");
}
this.minimumIntervalExpression = minimumIntervalExpression;
return this;
}


/** Create a new builder with the given name. */
public AutoDateHistogramAggregationBuilder(String name) {
super(name);
Expand All @@ -138,6 +124,14 @@ public AutoDateHistogramAggregationBuilder(StreamInput in) throws IOException {
}
}

@Override
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm moving this up under the reading ctor so it is easier to compare.

protected void innerWriteTo(StreamOutput out) throws IOException {
out.writeVInt(numBuckets);
if (out.getVersion().onOrAfter(Version.V_7_3_0)) {
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing this from 8_0_0 to 7_3_0 is the actual fix.

out.writeOptionalString(minimumIntervalExpression);
}
}

protected AutoDateHistogramAggregationBuilder(AutoDateHistogramAggregationBuilder clone, Builder factoriesBuilder,
Map<String, Object> metaData) {
super(clone, factoriesBuilder, metaData);
Expand All @@ -156,19 +150,24 @@ protected AggregationBuilder shallowCopy(Builder factoriesBuilder, Map<String, O
return new AutoDateHistogramAggregationBuilder(this, factoriesBuilder, metaData);
}

@Override
protected void innerWriteTo(StreamOutput out) throws IOException {
out.writeVInt(numBuckets);
if (out.getVersion().onOrAfter(Version.V_8_0_0)) {
out.writeOptionalString(minimumIntervalExpression);
}
}

@Override
public String getType() {
return NAME;
}

public String getMinimumIntervalExpression() {
return minimumIntervalExpression;
}

public AutoDateHistogramAggregationBuilder setMinimumIntervalExpression(String minimumIntervalExpression) {
if (minimumIntervalExpression != null && !ALLOWED_INTERVALS.containsValue(minimumIntervalExpression)) {
throw new IllegalArgumentException(MINIMUM_INTERVAL_FIELD.getPreferredName() +
" must be one of [" + ALLOWED_INTERVALS.values().toString() + "]");
}
this.minimumIntervalExpression = minimumIntervalExpression;
return this;
}

public AutoDateHistogramAggregationBuilder setNumBuckets(int numBuckets) {
if (numBuckets <= 0) {
throw new IllegalArgumentException(NUM_BUCKETS_FIELD.getPreferredName() + " must be greater than 0 for [" + name + "]");
Expand Down