[Ingest Manager] Set _meta in the index.mappings (#72026)

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
Alejandro Fernández Haro 2020-07-20 13:54:36 +01:00 committed by GitHub
parent bf89b3cdd2
commit f331cc8b64
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 32 additions and 7 deletions

View file

@ -87,6 +87,13 @@ exports[`tests loading base.yml: base.yml 1`] = `
"validarray": {
"type": "integer"
}
},
"_meta": {
"package": {
"name": "nginx"
},
"managed_by": "ingest-manager",
"managed": true
}
},
"aliases": {}
@ -190,6 +197,13 @@ exports[`tests loading coredns.logs.yml: coredns.logs.yml 1`] = `
}
}
}
},
"_meta": {
"package": {
"name": "coredns"
},
"managed_by": "ingest-manager",
"managed": true
}
},
"aliases": {}
@ -1677,6 +1691,13 @@ exports[`tests loading system.yml: system.yml 1`] = `
}
}
}
},
"_meta": {
"package": {
"name": "system"
},
"managed_by": "ingest-manager",
"managed": true
}
},
"aliases": {}

View file

@ -249,6 +249,15 @@ function getBaseTemplate(
packageName: string,
composedOfTemplates: string[]
): IndexTemplate {
// Meta information to identify Ingest Manager's managed templates and indices
const _meta = {
package: {
name: packageName,
},
managed_by: 'ingest-manager',
managed: true,
};
return {
// This takes precedence over all index templates installed by ES by default (logs-*-* and metrics-*-*)
// if this number is lower than the ES value (which is 100) this template will never be applied when a data stream
@ -304,19 +313,14 @@ function getBaseTemplate(
date_detection: false,
// All the properties we know from the fields.yml file
properties: mappings.properties,
_meta,
},
// To be filled with the aliases that we need
aliases: {},
},
data_stream: {},
composed_of: composedOfTemplates,
_meta: {
package: {
name: packageName,
},
managed_by: 'ingest-manager',
managed: true,
},
_meta,
};
}