Skip to content

Commit

Permalink
[TSVB] Disable using top_hits in pipeline aggregations (#82278)
Browse files Browse the repository at this point in the history
* [TSVB] Disable using top_hits in bucket script aggregations

* remove console message

* Correct schema for metrics size

* Chanhe hardcoded agg with the exported for the METRIC_TYPES var

* Exclude top_hit agg from all Sibling Pipeline Aggregations and all Parent Pipeline Aggregations

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
  • Loading branch information
stratoula and kibanamachine committed Nov 10, 2020
1 parent 471c281 commit a7a83fd
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/plugins/vis_type_timeseries/common/vis_schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export const metricsItems = schema.object({
type: stringRequired,
value: stringOptionalNullable,
values: schema.maybe(schema.nullable(schema.arrayOf(schema.nullable(schema.string())))),
size: stringOptionalNullable,
size: stringOrNumberOptionalNullable,
agg_with: stringOptionalNullable,
order: stringOptionalNullable,
order_by: stringOptionalNullable,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { createChangeHandler } from '../lib/create_change_handler';
import { createSelectHandler } from '../lib/create_select_handler';
import { createTextHandler } from '../lib/create_text_handler';
import { CalculationVars, newVariable } from './vars';
import { METRIC_TYPES } from '../../../../common/metric_types';
import { FormattedMessage } from '@kbn/i18n/react';

import {
Expand Down Expand Up @@ -99,6 +100,7 @@ export function CalculationAgg(props) {
onChange={handleChange}
name="variables"
model={model}
exclude={[METRIC_TYPES.TOP_HIT]}
/>
</EuiFlexItem>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { AggSelect } from './agg_select';
import { MetricSelect } from './metric_select';
import { createChangeHandler } from '../lib/create_change_handler';
import { createSelectHandler } from '../lib/create_select_handler';
import { METRIC_TYPES } from '../../../../common/metric_types';
import { FormattedMessage } from '@kbn/i18n/react';
import {
htmlIdGenerator,
Expand Down Expand Up @@ -80,6 +81,7 @@ export function CumulativeSumAgg(props) {
metrics={siblings}
metric={model}
value={model.field}
exclude={[METRIC_TYPES.TOP_HIT]}
/>
</EuiFormRow>
</EuiFlexItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { AggRow } from './agg_row';
import { createChangeHandler } from '../lib/create_change_handler';
import { createSelectHandler } from '../lib/create_select_handler';
import { createTextHandler } from '../lib/create_text_handler';
import { METRIC_TYPES } from '../../../../common/metric_types';
import {
htmlIdGenerator,
EuiFlexGroup,
Expand Down Expand Up @@ -91,6 +92,7 @@ export const DerivativeAgg = (props) => {
metrics={siblings}
metric={model}
value={model.field}
exclude={[METRIC_TYPES.TOP_HIT]}
fullWidth
/>
</EuiFormRow>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { MetricSelect } from './metric_select';
import { createChangeHandler } from '../lib/create_change_handler';
import { createSelectHandler } from '../lib/create_select_handler';
import { createNumberHandler } from '../lib/create_number_handler';
import { METRIC_TYPES } from '../../../../common/metric_types';
import {
htmlIdGenerator,
EuiFlexGroup,
Expand Down Expand Up @@ -153,6 +154,7 @@ export const MovingAverageAgg = (props) => {
metrics={siblings}
metric={model}
value={model.field}
exclude={[METRIC_TYPES.TOP_HIT]}
/>
</EuiFormRow>
</EuiFlexItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { MetricSelect } from './metric_select';
import { AggRow } from './agg_row';
import { createChangeHandler } from '../lib/create_change_handler';
import { createSelectHandler } from '../lib/create_select_handler';
import { METRIC_TYPES } from '../../../../common/metric_types';
import {
htmlIdGenerator,
EuiFlexGroup,
Expand Down Expand Up @@ -85,6 +86,7 @@ export const PositiveOnlyAgg = (props) => {
metrics={siblings}
metric={model}
value={model.field}
exclude={[METRIC_TYPES.TOP_HIT]}
/>
</EuiFormRow>
</EuiFlexItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { AggRow } from './agg_row';
import { createChangeHandler } from '../lib/create_change_handler';
import { createSelectHandler } from '../lib/create_select_handler';
import { createNumberHandler } from '../lib/create_number_handler';
import { METRIC_TYPES } from '../../../../common/metric_types';
import {
htmlIdGenerator,
EuiFlexGroup,
Expand Down Expand Up @@ -87,6 +88,7 @@ export const SerialDiffAgg = (props) => {
metrics={siblings}
metric={model}
value={model.field}
exclude={[METRIC_TYPES.TOP_HIT]}
/>
</EuiFormRow>
</EuiFlexItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import { AggSelect } from './agg_select';
import { createChangeHandler } from '../lib/create_change_handler';
import { createSelectHandler } from '../lib/create_select_handler';
import { createTextHandler } from '../lib/create_text_handler';
import { METRIC_TYPES } from '../../../../common/metric_types';

import {
htmlIdGenerator,
EuiFlexGroup,
Expand Down Expand Up @@ -154,7 +156,7 @@ const StandardSiblingAggUi = (props) => {
>
<MetricSelect
onChange={handleSelectChange('field')}
exclude={['percentile']}
exclude={[METRIC_TYPES.PERCENTILE, METRIC_TYPES.TOP_HIT]}
metrics={siblings}
metric={model}
value={model.field}
Expand All @@ -179,6 +181,7 @@ StandardSiblingAggUi.propTypes = {
series: PropTypes.object,
siblings: PropTypes.array,
uiRestrictions: PropTypes.object,
exclude: PropTypes.array,
};

export const StandardSiblingAgg = injectI18n(StandardSiblingAggUi);
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export class CalculationVars extends Component {
metric={this.props.model}
value={row.field}
includeSiblings={this.props.includeSiblings}
exclude={this.props.exclude}
/>
</EuiFlexItem>
<EuiFlexItem>
Expand Down

0 comments on commit a7a83fd

Please sign in to comment.