Skip to content

Commit

Permalink
Increase search.max_bucket by one (#70645) (#70706)
Browse files Browse the repository at this point in the history
  • Loading branch information
iverase authored Mar 23, 2021
1 parent 3871fae commit 81da10f
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docs/reference/aggregations/bucket.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ define fixed number of multiple buckets, and others dynamically create the bucke

NOTE: The maximum number of buckets allowed in a single response is limited by a
dynamic cluster setting named
<<search-settings-max-buckets,`search.max_buckets`>>. It defaults to 65,535.
<<search-settings-max-buckets,`search.max_buckets`>>. It defaults to 65,536.
Requests that try to return more than the limit will fail with an exception.

include::bucket/adjacency-matrix-aggregation.asciidoc[]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
* An aggregation service that creates instances of {@link MultiBucketConsumer}.
* The consumer is used by {@link BucketsAggregator} and {@link InternalMultiBucketAggregation} to limit the number of buckets created
* in {@link Aggregator#buildAggregations} and {@link InternalAggregation#reduce}.
* The limit can be set by changing the `search.max_buckets` cluster setting and defaults to 65535.
* The limit can be set by changing the `search.max_buckets` cluster setting and defaults to 65536.
*/
public class MultiBucketConsumerService {
public static final int DEFAULT_MAX_BUCKETS = 65535;
public static final int DEFAULT_MAX_BUCKETS = 65536;
public static final Setting<Integer> MAX_BUCKET_SETTING =
Setting.intSetting("search.max_buckets", DEFAULT_MAX_BUCKETS, 0, Setting.Property.NodeScope, Setting.Property.Dynamic);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public void testHardLimitForSortOnAggregate() throws IOException, SQLException {
SQLException.class,
() -> c.prepareStatement("SELECT max(a) max FROM test GROUP BY b ORDER BY max LIMIT 120000").executeQuery()
);
assertEquals("The maximum LIMIT for aggregate sorting is [65535], received [120000]", e.getMessage());
assertEquals("The maximum LIMIT for aggregate sorting is [65536], received [120000]", e.getMessage());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public void testHardLimitForSortOnAggregate() throws Exception {
index("test", body -> body.field("a", 1).field("b", 2));
String commandResult = command("SELECT max(a) max FROM test GROUP BY b ORDER BY max LIMIT 120000");
assertEquals(
START + "Bad request [[3;33;22mThe maximum LIMIT for aggregate sorting is [65535], received [120000]" + END,
START + "Bad request [[3;33;22mThe maximum LIMIT for aggregate sorting is [65536], received [120000]" + END,
commandResult
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ public void testHardLimitForSortOnAggregate() throws Exception {
index("{\"a\": 1, \"b\": 2}");
expectBadRequest(
() -> runSql(randomMode(), "SELECT max(a) max FROM test GROUP BY b ORDER BY max LIMIT 120000"),
containsString("The maximum LIMIT for aggregate sorting is [65535], received [120000]")
containsString("The maximum LIMIT for aggregate sorting is [65536], received [120000]")
);
}

Expand Down

0 comments on commit 81da10f

Please sign in to comment.