[Fleet] Remove aliases from index_template when updating an existing index template#91142
Conversation
4cabb34 to
0f84472
Compare
0f84472 to
0ceb61b
Compare
|
Pinging @elastic/fleet (Team:Fleet) |
…tall-template-aliases
pzl
left a comment
There was a problem hiding this comment.
I was able to reproduce original bug without the fix (using 7.10.2 ES + kibana container images going to 7.11.0 container images).
Then went through it again.
Except I grabbed 7.11 branch of kibana locally, cherry-picked from this PR (test file had a conflict, but since it was a test file I just deleted it for the verification here). And ran from that (7.11 + these changes) instead of kibana 7.11.0 image.
( the reason I did this was to keep using 7.11.0 ES, and keep the environment as close as possible to before)
I used the following command to print out index templates that contained aliases:
http -a elastic:changeme estc:9201/_index_template/ | jq ' .index_templates[] | select(.index_template.template.aliases != null) | .name'Which prints the following, before upgrade:
"metrics-system.process"
"metrics-system.fsstat"
"metrics-system.memory"
"metrics-endpoint.metadata"
"metrics-system.socket_summary"
"metrics-metadata-current"
"metrics-endpoint.metrics"
"metrics-system.load"
"metrics-system.core"
"logs-endpoint.events.security"
"logs-endpoint.events.registry"
"metrics-system.uptime"
"logs-endpoint.events.network"
"metrics-system.cpu"
"logs-endpoint.events.process"
"metrics-system.diskio"
"metrics-system.process_summary"
"logs-system.auth"
"metrics-endpoint.policy"
"logs-endpoint.events.library"
"metrics-system.network"
"metrics-system.filesystem"
"logs-system.syslog"
"logs-endpoint.alerts"
"logs-endpoint.events.file"
And after:
$ http -a elastic:changeme estc:9201/_index_template/ | jq ' .index_templates[] | select(.index_template.template.aliases != null) | .name'
"metrics-metadata-current"It looks like the Fleet upgrade went fine. I did see one error in the ES logs:
server log [13:37:20.056] [error][fleet][plugins] Error: error deleting pipeline logs-system.auth-0.9.1
at deletePipeline (/home/dan/dev/elastic/kibana/x-pack/plugins/fleet/server/services/epm/elasticsearch/ingest_pipeline/remove.ts:63:13)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async Promise.all (index 1)
at deletePreviousPipelines (/home/dan/dev/elastic/kibana/x-pack/plugins/fleet/server/services/epm/elasticsearch/ingest_pipeline/remove.ts:31:5)
at _installPackage (/home/dan/dev/elastic/kibana/x-pack/plugins/fleet/server/services/epm/packages/_install_package.ts:165:7)
at upgradePackage (/home/dan/dev/elastic/kibana/x-pack/plugins/fleet/server/services/epm/packages/install.ts:196:22)
but everything otherwise seems 👍
This does fix 90984
💚 Build SucceededMetrics [docs]
History
To update your PR or re-run it, just comment with: |
…template (elastic#91142) # Conflicts: # x-pack/plugins/fleet/server/services/epm/elasticsearch/template/install.test.ts
|
I have followed the instruction in the ticket, using the 7.10 branch and upgrading to 7.11, I can reproduce the error described in #90984. Applying the patch in this PR fixes the issue. I saw an error in the log I will create a follow. |
|
I reverted this PR due to a types failure: |
|
Friendly reminder: Looks like this PR hasn’t been backported yet. |

Description
Resolve #90984
Ensure we aliases from index_template when updating an existing index template
Context
When updating an index template we put new component template before updating the index template, this cause validation error in the case where the index template contains the
aliasesproperty. That PR ensure the aliases property is removed before.How to test
Start with a Kibana 7.10 setup fleet and endpoint than update to that PR you should be able to upgrade and go to fleet and the index_template for
logs-endpoint*should not contains aliasesLocally I tested it like this (without the fix I got the issue)
First run kibana from the
7.10branch,yarn es snapshot --license trial --password changeme -E xpack.security.authc.api_key.enabled=true -E path.data=/tmp/es-dataThan checkout that PR
yarn es snapshot --license trial --password changeme -E xpack.security.authc.api_key.enabled=true -E path.data=/tmp/es-data