Skip to content

Commit

Permalink
reverts #150954 (#152721)
Browse files Browse the repository at this point in the history
  • Loading branch information
ppisljar authored Mar 27, 2023
1 parent 89a5743 commit c77b23d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -242,15 +242,6 @@
"searchable": true,
"aggregatable": true
}
},
"hits": {
"int": {
"type": "integer",
"metadata_field": false,
"searchable": true,
"aggregatable": true,
"time_series_metric": "counter"
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ describe('index_patterns/field_capabilities/field_caps_response', () => {
describe('conflicts', () => {
it('returns a field for each in response, no filtering', () => {
const fields = readFieldCapsResponse(esResponse);
expect(fields).toHaveLength(25);
expect(fields).toHaveLength(24);
});

it(
Expand Down Expand Up @@ -164,11 +164,6 @@ describe('index_patterns/field_capabilities/field_caps_response', () => {
const child = fields.find((f) => f.name === 'object_parent.child');
expect(child).not.toHaveProperty('subType');
});
it('reports time series metrics counter as aggregatable: false', () => {
const fields = readFieldCapsResponse(esResponse);
const counter = fields.find((f) => f.name === 'hits');
expect(counter).toHaveProperty('aggregatable', false);
});
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ export function readFieldCapsResponse(
fieldCapsResponse: estypes.FieldCapsResponse
): FieldDescriptor[] {
const capsByNameThenType = fieldCapsResponse.fields;

const kibanaFormattedCaps = Object.keys(capsByNameThenType).reduce<{
array: FieldDescriptor[];
hash: Record<string, FieldDescriptor>;
Expand All @@ -90,17 +89,15 @@ export function readFieldCapsResponse(
);
});

const timeSeriesMetricProp = uniq(types.map((t) => capsByType[t].time_series_metric));
const isTimeSeriesCounter = !!timeSeriesMetricProp.find((item) => item === 'counter');
const isAggregatable = types.some((type) => {
return (
!!capsByType[type].aggregatable ||
(!!capsByType[type].non_aggregatable_indices &&
capsByType[type].non_aggregatable_indices!.length > 0)
);
});

const isAggregatable =
types.some((type) => {
return (
!!capsByType[type].aggregatable ||
(!!capsByType[type].non_aggregatable_indices &&
capsByType[type].non_aggregatable_indices!.length > 0)
);
}) && !isTimeSeriesCounter;
const timeSeriesMetricProp = uniq(types.map((t) => capsByType[t].time_series_metric));

// If there are multiple types but they all resolve to the same kibana type
// ignore the conflict and carry on (my wayward son)
Expand Down

0 comments on commit c77b23d

Please sign in to comment.