Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[EPM] handle disabled group fields for kibana index patterns #55735

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,12 @@ export const transformField = (field: Field, i: number, fields: Fields): IndexPa
export const flattenFields = (allFields: Fields): Fields => {
const flatten = (fields: Fields): Fields =>
fields.reduce<Field[]>((acc, field) => {
// recurse through nested fields
if (field.type === 'group' && field.fields?.length) {
// look for nested fields
acc = renameAndFlatten(field, field.fields, [...acc]);
// skip if field.enabled is not explicitly set to false
if (!field.hasOwnProperty('enabled') || field.enabled === true) {
acc = renameAndFlatten(field, field.fields, [...acc]);
}
} else {
// handle alias type fields
if (field.type === 'alias' && field.path) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
description: >
Contains fields for the Nginx access logs.
fields:
- name: group_disabled
type: group
enabled: false
fields:
- name: message
type: text
- name: remote_ip_list
type: array
description: >
Expand Down Expand Up @@ -109,4 +115,4 @@
- name: keyword
type: keyword
- name: text
type: text
type: text