Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[8.x] [Mappings editor] Handle unsupported types (elastic#198185) (el…
…astic#198421) # Backport This will backport the following commits from `main` to `8.x`: - [[Mappings editor] Handle unsupported types (elastic#198185)](elastic#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 (elastic#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 (elastic#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 (elastic#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]>
- Loading branch information