[Maps] increase DEFAULT_MAX_BUCKETS_LIMIT to 65535 (#70313)

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
Nathan Reese 2020-07-14 16:07:22 -06:00 committed by GitHub
parent a81d8b55ab
commit 0e7c3c7ff0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 17 additions and 11 deletions

View file

@ -90,7 +90,7 @@ export const DECIMAL_DEGREES_PRECISION = 5; // meters precision
export const ZOOM_PRECISION = 2;
export const DEFAULT_MAX_RESULT_WINDOW = 10000;
export const DEFAULT_MAX_INNER_RESULT_WINDOW = 100;
export const DEFAULT_MAX_BUCKETS_LIMIT = 10000;
export const DEFAULT_MAX_BUCKETS_LIMIT = 65535;
export const FEATURE_ID_PROPERTY_NAME = '__kbn__feature_id__';
export const FEATURE_VISIBLE_PROPERTY_NAME = '__kbn_isvisibleduetojoin__';

View file

@ -17,6 +17,8 @@ import { TopTermPercentageField } from './top_term_percentage_field';
import { ITooltipProperty, TooltipProperty } from '../tooltips/tooltip_property';
import { ESAggTooltipProperty } from '../tooltips/es_agg_tooltip_property';
const TERMS_AGG_SHARD_SIZE = 5;
export interface IESAggField extends IField {
getValueAggDsl(indexPattern: IndexPattern): unknown | null;
getBucketCount(): number;
@ -100,7 +102,7 @@ export class ESAggField implements IESAggField {
const field = getField(indexPattern, this.getRootName());
const aggType = this.getAggType();
const aggBody = aggType === AGG_TYPE.TERMS ? { size: 1, shard_size: 1 } : {};
const aggBody = aggType === AGG_TYPE.TERMS ? { size: 1, shard_size: TERMS_AGG_SHARD_SIZE } : {};
return {
[aggType]: addFieldToDSL(aggBody, field),
};
@ -108,7 +110,7 @@ export class ESAggField implements IESAggField {
getBucketCount(): number {
// terms aggregation increases the overall number of buckets per split bucket
return this.getAggType() === AGG_TYPE.TERMS ? 1 : 0;
return this.getAggType() === AGG_TYPE.TERMS ? TERMS_AGG_SHARD_SIZE : 0;
}
supportsFieldMeta(): boolean {

View file

@ -161,6 +161,7 @@ export class ESGeoGridSource extends AbstractESAggSource {
bounds: makeESBbox(bufferedExtent),
field: this._descriptor.geoField,
precision,
size: DEFAULT_MAX_BUCKETS_LIMIT,
},
},
},
@ -245,6 +246,8 @@ export class ESGeoGridSource extends AbstractESAggSource {
bounds: makeESBbox(bufferedExtent),
field: this._descriptor.geoField,
precision,
size: DEFAULT_MAX_BUCKETS_LIMIT,
shard_size: DEFAULT_MAX_BUCKETS_LIMIT,
},
aggs: {
gridCentroid: {

View file

@ -400,8 +400,9 @@ export function getBoundingBoxGeometry(geometry) {
export function formatEnvelopeAsPolygon({ maxLat, maxLon, minLat, minLon }) {
// GeoJSON mandates that the outer polygon must be counterclockwise to avoid ambiguous polygons
// when the shape crosses the dateline
const left = minLon;
const right = maxLon;
const lonDelta = maxLon - minLon;
const left = lonDelta > 360 ? -180 : minLon;
const right = lonDelta > 360 ? 180 : maxLon;
const top = clampToLatBounds(maxLat);
const bottom = clampToLatBounds(minLat);
const topLeft = [left, top];

View file

@ -421,7 +421,7 @@ describe('createExtentFilter', () => {
});
});
it('should not clamp longitudes to -180 to 180', () => {
it('should clamp longitudes to -180 to 180 when lonitude wraps globe', () => {
const mapExtent = {
maxLat: 39,
maxLon: 209,
@ -436,11 +436,11 @@ describe('createExtentFilter', () => {
shape: {
coordinates: [
[
[-191, 39],
[-191, 35],
[209, 35],
[209, 39],
[-191, 39],
[-180, 39],
[-180, 35],
[180, 35],
[180, 39],
[-180, 39],
],
],
type: 'Polygon',