-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Mappings editor] Handle unsupported types #198185
[Mappings editor] Handle unsupported types #198185
Conversation
Pinging @elastic/kibana-management (Team:Kibana Management) |
💛 Build succeeded, but was flaky
Failed CI Steps
Metrics [docs]Async chunks
Historycc @ElenaStoeva |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changes look good and work well!
Starting backport for target branches: 8.x https://github.com/elastic/kibana/actions/runs/11599047795 |
Fixes elastic#197592 ## Summary This PR fixes the bug where the index Mappings details page crashes if the index has a mapping field with a type that is not recognized in Kibana. We fix this by using `getTypeLabelFromField` instead of directly fetching the `label` property of an object that might be `undefined` - `getTypeLabelFromField` takes care of this case. **How to test:** 1. Create the following index in Console (it has the unsupported `counted_keyword` field type): ``` PUT test { "mappings": { "properties": { "@timestamp": { "type": "date" }, "log": { "type": "text" }, "ids": { "type": "counted_keyword" } } } } ``` 2. Go to Index Management and click on the index that we just created 3. Go to Mappings tab 4. Verify that the page loads correctly 5. Check that the opening filter and selecting an option doesn't make the page crash. https://github.com/user-attachments/assets/4a595968-7cd8-4d36-9a53-264a0d5db50f (cherry picked from commit 3c5319f)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
# Backport This will backport the following commits from `main` to `8.x`: - [[Mappings editor] Handle unsupported types (#198185)](#198185) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Elena Stoeva","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-10-30T18:03:36Z","message":"[Mappings editor] Handle unsupported types (#198185)\n\nFixes https://github.com/elastic/kibana/issues/197592\r\n\r\n## Summary\r\n\r\nThis PR fixes the bug where the index Mappings details page crashes if\r\nthe index has a mapping field with a type that is not recognized in\r\nKibana. We fix this by using `getTypeLabelFromField` instead of directly\r\nfetching the `label` property of an object that might be `undefined` -\r\n`getTypeLabelFromField` takes care of this case.\r\n\r\n**How to test:**\r\n1. Create the following index in Console (it has the unsupported\r\n`counted_keyword` field type):\r\n```\r\nPUT test\r\n{\r\n \"mappings\": {\r\n \"properties\": {\r\n \"@timestamp\": {\r\n \"type\": \"date\"\r\n },\r\n \"log\": {\r\n \"type\": \"text\"\r\n },\r\n \"ids\": {\r\n \"type\": \"counted_keyword\"\r\n }\r\n }\r\n }\r\n}\r\n```\r\n2. Go to Index Management and click on the index that we just created\r\n3. Go to Mappings tab\r\n4. Verify that the page loads correctly\r\n5. Check that the opening filter and selecting an option doesn't make\r\nthe page crash.\r\n\r\n\r\n\r\nhttps://github.com/user-attachments/assets/4a595968-7cd8-4d36-9a53-264a0d5db50f","sha":"3c5319f2152cb38333e53dd2cc993aada8a38e34","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Kibana Management","release_note:skip","Feature:Mappings Editor","v9.0.0","backport:prev-minor","v8.17.0"],"title":"[Mappings editor] Handle unsupported types","number":198185,"url":"https://github.com/elastic/kibana/pull/198185","mergeCommit":{"message":"[Mappings editor] Handle unsupported types (#198185)\n\nFixes https://github.com/elastic/kibana/issues/197592\r\n\r\n## Summary\r\n\r\nThis PR fixes the bug where the index Mappings details page crashes if\r\nthe index has a mapping field with a type that is not recognized in\r\nKibana. We fix this by using `getTypeLabelFromField` instead of directly\r\nfetching the `label` property of an object that might be `undefined` -\r\n`getTypeLabelFromField` takes care of this case.\r\n\r\n**How to test:**\r\n1. Create the following index in Console (it has the unsupported\r\n`counted_keyword` field type):\r\n```\r\nPUT test\r\n{\r\n \"mappings\": {\r\n \"properties\": {\r\n \"@timestamp\": {\r\n \"type\": \"date\"\r\n },\r\n \"log\": {\r\n \"type\": \"text\"\r\n },\r\n \"ids\": {\r\n \"type\": \"counted_keyword\"\r\n }\r\n }\r\n }\r\n}\r\n```\r\n2. Go to Index Management and click on the index that we just created\r\n3. Go to Mappings tab\r\n4. Verify that the page loads correctly\r\n5. Check that the opening filter and selecting an option doesn't make\r\nthe page crash.\r\n\r\n\r\n\r\nhttps://github.com/user-attachments/assets/4a595968-7cd8-4d36-9a53-264a0d5db50f","sha":"3c5319f2152cb38333e53dd2cc993aada8a38e34"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/198185","number":198185,"mergeCommit":{"message":"[Mappings editor] Handle unsupported types (#198185)\n\nFixes https://github.com/elastic/kibana/issues/197592\r\n\r\n## Summary\r\n\r\nThis PR fixes the bug where the index Mappings details page crashes if\r\nthe index has a mapping field with a type that is not recognized in\r\nKibana. We fix this by using `getTypeLabelFromField` instead of directly\r\nfetching the `label` property of an object that might be `undefined` -\r\n`getTypeLabelFromField` takes care of this case.\r\n\r\n**How to test:**\r\n1. Create the following index in Console (it has the unsupported\r\n`counted_keyword` field type):\r\n```\r\nPUT test\r\n{\r\n \"mappings\": {\r\n \"properties\": {\r\n \"@timestamp\": {\r\n \"type\": \"date\"\r\n },\r\n \"log\": {\r\n \"type\": \"text\"\r\n },\r\n \"ids\": {\r\n \"type\": \"counted_keyword\"\r\n }\r\n }\r\n }\r\n}\r\n```\r\n2. Go to Index Management and click on the index that we just created\r\n3. Go to Mappings tab\r\n4. Verify that the page loads correctly\r\n5. Check that the opening filter and selecting an option doesn't make\r\nthe page crash.\r\n\r\n\r\n\r\nhttps://github.com/user-attachments/assets/4a595968-7cd8-4d36-9a53-264a0d5db50f","sha":"3c5319f2152cb38333e53dd2cc993aada8a38e34"}},{"branch":"8.x","label":"v8.17.0","branchLabelMappingKey":"^v8.17.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Elena Stoeva <[email protected]>
Fixes #197592
Summary
This PR fixes the bug where the index Mappings details page crashes if the index has a mapping field with a type that is not recognized in Kibana. We fix this by using
getTypeLabelFromField
instead of directly fetching thelabel
property of an object that might beundefined
-getTypeLabelFromField
takes care of this case.How to test:
counted_keyword
field type):Screen.Recording.2024-10-29.at.15.07.28.mov