mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
* Revert "Flag nested fields as non-aggregatable (#51774)" This reverts commitc7046a08
* Filter out nested fields at the agg param level * Forbid nested fields in TSVB * Revert "Forbid nested fields in TSVB" This reverts commitafcaa348
Co-authored-by: Tim Roes <mail@timroes.de> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: Matt Bargar <mbargar@gmail.com> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
parent
3dd7241bfb
commit
cc3274507d
4 changed files with 6 additions and 18 deletions
|
@ -115,7 +115,10 @@ export class FieldParamType extends BaseParamType {
|
|||
const filteredFields = fields.filter((field: Field) => {
|
||||
const { onlyAggregatable, scriptable, filterFieldTypes } = this;
|
||||
|
||||
if ((onlyAggregatable && !field.aggregatable) || (!scriptable && field.scripted)) {
|
||||
if (
|
||||
(onlyAggregatable && (!field.aggregatable || field.subType?.nested)) ||
|
||||
(!scriptable && field.scripted)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -143,13 +143,6 @@ describe('index_patterns/field_capabilities/field_caps_response', () => {
|
|||
expect(child).toHaveProperty('subType', { nested: { path: 'nested_object_parent' } });
|
||||
});
|
||||
|
||||
it('returns nested sub-fields as non-aggregatable', () => {
|
||||
const fields = readFieldCapsResponse(esResponse);
|
||||
// Normally a keyword field would be aggregatable, but the fact that it is nested overrides that
|
||||
const child = fields.find(f => f.name === 'nested_object_parent.child.keyword');
|
||||
expect(child).toHaveProperty('aggregatable', false);
|
||||
});
|
||||
|
||||
it('handles fields that are both nested and multi', () => {
|
||||
const fields = readFieldCapsResponse(esResponse);
|
||||
const child = fields.find(f => f.name === 'nested_object_parent.child.keyword');
|
||||
|
|
|
@ -182,14 +182,6 @@ export function readFieldCapsResponse(fieldCapsResponse: FieldCapsResponse): Fie
|
|||
|
||||
if (Object.keys(subType).length > 0) {
|
||||
field.subType = subType;
|
||||
|
||||
// We don't support aggregating on nested fields, trying to do so in the UI will return
|
||||
// blank results. For now we will stop showing nested fields as an option for aggregation.
|
||||
// Once we add support for nested fields this condition should be removed and old index
|
||||
// patterns should be migrated.
|
||||
if (field.subType.nested) {
|
||||
field.aggregatable = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -72,7 +72,7 @@ export default function({ getService }) {
|
|||
readFromDocValues: true,
|
||||
},
|
||||
{
|
||||
aggregatable: false,
|
||||
aggregatable: true,
|
||||
esTypes: ['keyword'],
|
||||
name: 'nestedField.child',
|
||||
readFromDocValues: true,
|
||||
|
@ -154,7 +154,7 @@ export default function({ getService }) {
|
|||
readFromDocValues: true,
|
||||
},
|
||||
{
|
||||
aggregatable: false,
|
||||
aggregatable: true,
|
||||
esTypes: ['keyword'],
|
||||
name: 'nestedField.child',
|
||||
readFromDocValues: true,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue