mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
Flag nested fields as non-aggregatable (#51774)
* Flag nested fields as non-aggregatable * Update tests
This commit is contained in:
parent
419ea47cca
commit
c7046a080f
3 changed files with 17 additions and 2 deletions
|
@ -144,6 +144,13 @@ 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,6 +182,14 @@ 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: true,
|
||||
aggregatable: false,
|
||||
esTypes: [
|
||||
'keyword'
|
||||
],
|
||||
|
@ -156,7 +156,7 @@ export default function ({ getService }) {
|
|||
readFromDocValues: true,
|
||||
},
|
||||
{
|
||||
aggregatable: true,
|
||||
aggregatable: false,
|
||||
esTypes: [
|
||||
'keyword'
|
||||
],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue