-
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] Add support for synthetic _source #199854
[Mappings Editor] Add support for synthetic _source #199854
Conversation
b234d7a
to
96ec5ac
Compare
1b18c86
to
32d6672
Compare
Pinging @elastic/kibana-management (Team:Kibana Management) |
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.
Copy LGTM
@@ -27,7 +77,7 @@ export const SourceFieldSection = () => { | |||
<p> | |||
<FormattedMessage | |||
id="xpack.idxMgmt.mappingsEditor.disabledSourceFieldCallOutDescription1" | |||
defaultMessage="Disabling {source} lowers storage overhead within the index, but this comes at a cost. It also disables important features, such as the ability to reindex or debug queries by viewing the original document." | |||
defaultMessage="Disabling {source} is not recommended. If storage overhead is a concer, consider using synthetic {source} instead. Disabling {source} will disable important features, such as the ability to reindex or debug queries by viewing the original document." |
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.
defaultMessage="Disabling {source} is not recommended. If storage overhead is a concer, consider using synthetic {source} instead. Disabling {source} will disable important features, such as the ability to reindex or debug queries by viewing the original document." | |
defaultMessage="Disabling {source} is not recommended. If storage overhead is a concern, consider using synthetic {source} instead. Disabling {source} will disable important features, such as the ability to reindex or debug queries by viewing the original document." |
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.
Thanks @florent-leborgne! Fixed the typo with aa2b19b.
Converted back to a draft as I found one issue with setting synthetic source when index mode is logsdb/time series. |
…com/ElenaStoeva/kibana into mappings-configuration/source-field
cdc8827
to
12d3b27
Compare
💚 Build Succeeded
Metrics [docs]Module Count
Async chunks
Page load bundle
History
cc @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.
Nice work @ElenaStoeva! Tested locally and changes lgtm, left two small comments but for sake of speed might be worth to revise in a subsequent PR. What I do would like to see though, is perhaps a test for the license check to make sure the synthetic option isn't show with a basic license. wdyt?
@@ -120,6 +128,40 @@ export const MappingsEditor = React.memo( | |||
[dispatch] | |||
); | |||
|
|||
const [isLicenseCheckComplete, setIsLicenseCheckComplete] = useState(false); | |||
useEffect(() => { | |||
const subscription = licensing?.license$.subscribe((license: ILicense) => { |
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.
what do you think about extracting the license check subcription check into the plugin level and just pass something like canUseSyntheticOption
variable into the renderApp
method? that way we dont have tightly coupled logic and if the license condition changes its easier to update (I think we did something similar for checking if the user can use the new api key trust model in remote clusters)
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.
That's a great idea! This might actually help with testing if the synthetic option is displayed or not based on the license. I think the issues that I face now might be due to the fact that in the initial render the check is not complete and so the synthetic option is not displayed even when it should.
@@ -37,12 +48,30 @@ const formSerializer = (formData: GenericObject, sourceFieldMode?: string) => { | |||
? 'strict' | |||
: dynamicMapping?.enabled; | |||
|
|||
const _source = |
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.
nit: It might just be me, but this seems a little too complex to read at first glance. Perhaps a more explicit structure could make future extensions more straightforward? 🤔
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.
I totally understand! I did my best to make it as clear as possible but it's a bit tricky given that the sourceField.option
field actually controls two properties in Es (mode
and enabled
). We also don't want to add the mode
property if the field is undefined (which means it hasn't been set by the user) - otherwise, just opening the "Advanced options" tab would insert a "mode" property which is a behavior that we recently managed to fix in this form. I'm open to any suggestions for shortening/simplifying the code.
Many thanks for the review @sabarasaba! Yes, I also think we can address these comments in a separate PR so that we can merge this today.
Haha trust me, I'd also love to see this 😆 I spent quite a bit of time trying to implement these but it turned out trickier than I hoped. I initially added such tests with 32d6672 but then I had to change the implementation and they no longer worked as now the license check is performed in the parent component (the Mappings editor) instead of the Configuration form. I also tried adding these tests in the I think if we refactor the license check code as you suggested these tests might be easier to implement. Edit: Opened an issue for the improvements: #200769 |
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.
Approving so we can get it merged today, and we can patch the rest of the feedback in a subsequent PR 🚀
Starting backport for target branches: 8.x |
Closes elastic#198621 ## Summary This PR adds support for the synthetic _source field in the mappings Advanced options. Stored option: <img width="1184" alt="Screenshot 2024-11-14 at 19 19 19" src="https://github.com/user-attachments/assets/086f7a3e-9ca1-42de-9f9c-d3599d839ccf"> Synthetic option selected: <img width="1184" alt="Screenshot 2024-11-14 at 19 19 27" src="https://github.com/user-attachments/assets/3700bced-212a-4378-b51a-ab7a0f4f7b99"> Disabled option selected: <img width="1184" alt="Screenshot 2024-11-14 at 19 19 36" src="https://github.com/user-attachments/assets/c7ddcbae-7c78-4477-824e-99b144a1f750"> https://github.com/user-attachments/assets/399d0f95-a5dd-4874-bb8c-e95d6ed38465 How to test: 1. Start Es with `yarn es snapshot --license` (we need Enterprise license to see the Synthetic source option) and Kibana with `yarn start` 2. Go to Index templates/Component templates and start creating a template 3. At the Mappings step, go to Advanced options. 4. Verify that selecting a _source field option translates to the correct Es request. 5. In Index templates form, verify that the default _source option depends on the index mode selected in the Logistics step. For LogsDB and Time series index mode, the default should be synthetic mode; otherwise, the stored option. 6. Verify that in Basic license, the synthetic option is not displayed. ### Checklist - [x] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md) - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [x] Any UI touched in this PR is usable by keyboard only (learn more about [keyboard accessibility](https://webaim.org/techniques/keyboard/)) - [x] Any UI touched in this PR does not create any new axe failures (run axe in browser: [FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/), [Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US)) - [x] This renders correctly on smaller devices using a responsive layout. (You can test this [in your browser](https://www.browserstack.com/guide/responsive-testing-on-local-server)) - [x] This was checked for [cross-browser compatibility](https://www.elastic.co/support/matrix#matrix_browsers) --------- Co-authored-by: kibanamachine <[email protected]> (cherry picked from commit 8be679a)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…200776) # Backport This will backport the following commits from `main` to `8.x`: - [[Mappings Editor] Add support for synthetic _source (#199854)](#199854) <!--- 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-11-19T16:49:50Z","message":"[Mappings Editor] Add support for synthetic _source (#199854)\n\nCloses https://github.com/elastic/kibana/issues/198621\r\n\r\n## Summary\r\n\r\nThis PR adds support for the synthetic _source field in the mappings\r\nAdvanced options.\r\n\r\nStored option:\r\n<img width=\"1184\" alt=\"Screenshot 2024-11-14 at 19 19 19\"\r\nsrc=\"https://github.com/user-attachments/assets/086f7a3e-9ca1-42de-9f9c-d3599d839ccf\">\r\n\r\nSynthetic option selected:\r\n<img width=\"1184\" alt=\"Screenshot 2024-11-14 at 19 19 27\"\r\nsrc=\"https://github.com/user-attachments/assets/3700bced-212a-4378-b51a-ab7a0f4f7b99\">\r\n\r\nDisabled option selected:\r\n<img width=\"1184\" alt=\"Screenshot 2024-11-14 at 19 19 36\"\r\nsrc=\"https://github.com/user-attachments/assets/c7ddcbae-7c78-4477-824e-99b144a1f750\">\r\n\r\n\r\n\r\n\r\nhttps://github.com/user-attachments/assets/399d0f95-a5dd-4874-bb8c-e95d6ed38465\r\n\r\n\r\n\r\n\r\nHow to test:\r\n1. Start Es with `yarn es snapshot --license` (we need Enterprise\r\nlicense to see the Synthetic source option) and Kibana with `yarn start`\r\n2. Go to Index templates/Component templates and start creating a\r\ntemplate\r\n3. At the Mappings step, go to Advanced options.\r\n4. Verify that selecting a _source field option translates to the\r\ncorrect Es request.\r\n5. In Index templates form, verify that the default _source option\r\ndepends on the index mode selected in the Logistics step. For LogsDB and\r\nTime series index mode, the default should be synthetic mode; otherwise,\r\nthe stored option.\r\n6. Verify that in Basic license, the synthetic option is not displayed.\r\n\r\n\r\n\r\n### Checklist\r\n\r\n- [x] Any text added follows [EUI's writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\r\nsentence case text and includes [i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n- [x] Any UI touched in this PR is usable by keyboard only (learn more\r\nabout [keyboard accessibility](https://webaim.org/techniques/keyboard/))\r\n- [x] Any UI touched in this PR does not create any new axe failures\r\n(run axe in browser:\r\n[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),\r\n[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))\r\n- [x] This renders correctly on smaller devices using a responsive\r\nlayout. (You can test this [in your\r\nbrowser](https://www.browserstack.com/guide/responsive-testing-on-local-server))\r\n- [x] This was checked for [cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <[email protected]>","sha":"8be679ae20fb7f5c41ccb3554b6db3dc2cad0678","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] Add support for synthetic _source","number":199854,"url":"https://github.com/elastic/kibana/pull/199854","mergeCommit":{"message":"[Mappings Editor] Add support for synthetic _source (#199854)\n\nCloses https://github.com/elastic/kibana/issues/198621\r\n\r\n## Summary\r\n\r\nThis PR adds support for the synthetic _source field in the mappings\r\nAdvanced options.\r\n\r\nStored option:\r\n<img width=\"1184\" alt=\"Screenshot 2024-11-14 at 19 19 19\"\r\nsrc=\"https://github.com/user-attachments/assets/086f7a3e-9ca1-42de-9f9c-d3599d839ccf\">\r\n\r\nSynthetic option selected:\r\n<img width=\"1184\" alt=\"Screenshot 2024-11-14 at 19 19 27\"\r\nsrc=\"https://github.com/user-attachments/assets/3700bced-212a-4378-b51a-ab7a0f4f7b99\">\r\n\r\nDisabled option selected:\r\n<img width=\"1184\" alt=\"Screenshot 2024-11-14 at 19 19 36\"\r\nsrc=\"https://github.com/user-attachments/assets/c7ddcbae-7c78-4477-824e-99b144a1f750\">\r\n\r\n\r\n\r\n\r\nhttps://github.com/user-attachments/assets/399d0f95-a5dd-4874-bb8c-e95d6ed38465\r\n\r\n\r\n\r\n\r\nHow to test:\r\n1. Start Es with `yarn es snapshot --license` (we need Enterprise\r\nlicense to see the Synthetic source option) and Kibana with `yarn start`\r\n2. Go to Index templates/Component templates and start creating a\r\ntemplate\r\n3. At the Mappings step, go to Advanced options.\r\n4. Verify that selecting a _source field option translates to the\r\ncorrect Es request.\r\n5. In Index templates form, verify that the default _source option\r\ndepends on the index mode selected in the Logistics step. For LogsDB and\r\nTime series index mode, the default should be synthetic mode; otherwise,\r\nthe stored option.\r\n6. Verify that in Basic license, the synthetic option is not displayed.\r\n\r\n\r\n\r\n### Checklist\r\n\r\n- [x] Any text added follows [EUI's writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\r\nsentence case text and includes [i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n- [x] Any UI touched in this PR is usable by keyboard only (learn more\r\nabout [keyboard accessibility](https://webaim.org/techniques/keyboard/))\r\n- [x] Any UI touched in this PR does not create any new axe failures\r\n(run axe in browser:\r\n[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),\r\n[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))\r\n- [x] This renders correctly on smaller devices using a responsive\r\nlayout. (You can test this [in your\r\nbrowser](https://www.browserstack.com/guide/responsive-testing-on-local-server))\r\n- [x] This was checked for [cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <[email protected]>","sha":"8be679ae20fb7f5c41ccb3554b6db3dc2cad0678"}},"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/199854","number":199854,"mergeCommit":{"message":"[Mappings Editor] Add support for synthetic _source (#199854)\n\nCloses https://github.com/elastic/kibana/issues/198621\r\n\r\n## Summary\r\n\r\nThis PR adds support for the synthetic _source field in the mappings\r\nAdvanced options.\r\n\r\nStored option:\r\n<img width=\"1184\" alt=\"Screenshot 2024-11-14 at 19 19 19\"\r\nsrc=\"https://github.com/user-attachments/assets/086f7a3e-9ca1-42de-9f9c-d3599d839ccf\">\r\n\r\nSynthetic option selected:\r\n<img width=\"1184\" alt=\"Screenshot 2024-11-14 at 19 19 27\"\r\nsrc=\"https://github.com/user-attachments/assets/3700bced-212a-4378-b51a-ab7a0f4f7b99\">\r\n\r\nDisabled option selected:\r\n<img width=\"1184\" alt=\"Screenshot 2024-11-14 at 19 19 36\"\r\nsrc=\"https://github.com/user-attachments/assets/c7ddcbae-7c78-4477-824e-99b144a1f750\">\r\n\r\n\r\n\r\n\r\nhttps://github.com/user-attachments/assets/399d0f95-a5dd-4874-bb8c-e95d6ed38465\r\n\r\n\r\n\r\n\r\nHow to test:\r\n1. Start Es with `yarn es snapshot --license` (we need Enterprise\r\nlicense to see the Synthetic source option) and Kibana with `yarn start`\r\n2. Go to Index templates/Component templates and start creating a\r\ntemplate\r\n3. At the Mappings step, go to Advanced options.\r\n4. Verify that selecting a _source field option translates to the\r\ncorrect Es request.\r\n5. In Index templates form, verify that the default _source option\r\ndepends on the index mode selected in the Logistics step. For LogsDB and\r\nTime series index mode, the default should be synthetic mode; otherwise,\r\nthe stored option.\r\n6. Verify that in Basic license, the synthetic option is not displayed.\r\n\r\n\r\n\r\n### Checklist\r\n\r\n- [x] Any text added follows [EUI's writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\r\nsentence case text and includes [i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n- [x] Any UI touched in this PR is usable by keyboard only (learn more\r\nabout [keyboard accessibility](https://webaim.org/techniques/keyboard/))\r\n- [x] Any UI touched in this PR does not create any new axe failures\r\n(run axe in browser:\r\n[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),\r\n[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))\r\n- [x] This renders correctly on smaller devices using a responsive\r\nlayout. (You can test this [in your\r\nbrowser](https://www.browserstack.com/guide/responsive-testing-on-local-server))\r\n- [x] This was checked for [cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <[email protected]>","sha":"8be679ae20fb7f5c41ccb3554b6db3dc2cad0678"}},{"branch":"8.x","label":"v8.17.0","branchLabelMappingKey":"^v8.17.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Elena Stoeva <[email protected]>
Closes #200769 ## Summary This PR is a follow-up to #199854 and it adds the following code improvements: - Replaces Mappings-editor-context-level property `hasEnterpriceLicense` with plugin-context-level `canUseSyntheticSource` property - Adds jest tests to check if the synthetic option is correctly displayed based on license - Improves readability of serializer logic for the source field **How to test:** The same test instructions from #199854 can be followed with a focus on checking that the synthetic option is only available in Enterprise license.
) Closes elastic#200769 ## Summary This PR is a follow-up to elastic#199854 and it adds the following code improvements: - Replaces Mappings-editor-context-level property `hasEnterpriceLicense` with plugin-context-level `canUseSyntheticSource` property - Adds jest tests to check if the synthetic option is correctly displayed based on license - Improves readability of serializer logic for the source field **How to test:** The same test instructions from elastic#199854 can be followed with a focus on checking that the synthetic option is only available in Enterprise license. (cherry picked from commit 762bb7f)
) Closes elastic#200769 ## Summary This PR is a follow-up to elastic#199854 and it adds the following code improvements: - Replaces Mappings-editor-context-level property `hasEnterpriceLicense` with plugin-context-level `canUseSyntheticSource` property - Adds jest tests to check if the synthetic option is correctly displayed based on license - Improves readability of serializer logic for the source field **How to test:** The same test instructions from elastic#199854 can be followed with a focus on checking that the synthetic option is only available in Enterprise license. (cherry picked from commit 762bb7f)
…) (#201577) # Backport This will backport the following commits from `main` to `8.x`: - [[Mappings editor] Add code improvements for source field (#201188)](#201188) <!--- 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-11-25T12:46:05Z","message":"[Mappings editor] Add code improvements for source field (#201188)\n\nCloses https://github.com/elastic/kibana/issues/200769\r\n\r\n## Summary\r\n\r\nThis PR is a follow-up to https://github.com/elastic/kibana/pull/199854\r\nand it adds the following code improvements:\r\n\r\n- Replaces Mappings-editor-context-level property `hasEnterpriceLicense`\r\nwith plugin-context-level `canUseSyntheticSource` property\r\n- Adds jest tests to check if the synthetic option is correctly\r\ndisplayed based on license\r\n- Improves readability of serializer logic for the source field\r\n\r\n\r\n**How to test:**\r\nThe same test instructions from\r\nhttps://github.com//pull/199854 can be followed with a\r\nfocus on checking that the synthetic option is only available in\r\nEnterprise license.","sha":"762bb7f59d1d980aa34358c62ae0ef53e81f726e","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.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","v8.18.0"],"title":"[Mappings editor] Add code improvements for source field","number":201188,"url":"https://github.com/elastic/kibana/pull/201188","mergeCommit":{"message":"[Mappings editor] Add code improvements for source field (#201188)\n\nCloses https://github.com/elastic/kibana/issues/200769\r\n\r\n## Summary\r\n\r\nThis PR is a follow-up to https://github.com/elastic/kibana/pull/199854\r\nand it adds the following code improvements:\r\n\r\n- Replaces Mappings-editor-context-level property `hasEnterpriceLicense`\r\nwith plugin-context-level `canUseSyntheticSource` property\r\n- Adds jest tests to check if the synthetic option is correctly\r\ndisplayed based on license\r\n- Improves readability of serializer logic for the source field\r\n\r\n\r\n**How to test:**\r\nThe same test instructions from\r\nhttps://github.com//pull/199854 can be followed with a\r\nfocus on checking that the synthetic option is only available in\r\nEnterprise license.","sha":"762bb7f59d1d980aa34358c62ae0ef53e81f726e"}},"sourceBranch":"main","suggestedTargetBranches":["8.17","8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/201188","number":201188,"mergeCommit":{"message":"[Mappings editor] Add code improvements for source field (#201188)\n\nCloses https://github.com/elastic/kibana/issues/200769\r\n\r\n## Summary\r\n\r\nThis PR is a follow-up to https://github.com/elastic/kibana/pull/199854\r\nand it adds the following code improvements:\r\n\r\n- Replaces Mappings-editor-context-level property `hasEnterpriceLicense`\r\nwith plugin-context-level `canUseSyntheticSource` property\r\n- Adds jest tests to check if the synthetic option is correctly\r\ndisplayed based on license\r\n- Improves readability of serializer logic for the source field\r\n\r\n\r\n**How to test:**\r\nThe same test instructions from\r\nhttps://github.com//pull/199854 can be followed with a\r\nfocus on checking that the synthetic option is only available in\r\nEnterprise license.","sha":"762bb7f59d1d980aa34358c62ae0ef53e81f726e"}},{"branch":"8.17","label":"v8.17.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.x","label":"v8.18.0","branchLabelMappingKey":"^v8.18.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Elena Stoeva <[email protected]>
) (#201576) # Backport This will backport the following commits from `main` to `8.17`: - [[Mappings editor] Add code improvements for source field (#201188)](#201188) <!--- 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-11-25T12:46:05Z","message":"[Mappings editor] Add code improvements for source field (#201188)\n\nCloses https://github.com/elastic/kibana/issues/200769\r\n\r\n## Summary\r\n\r\nThis PR is a follow-up to https://github.com/elastic/kibana/pull/199854\r\nand it adds the following code improvements:\r\n\r\n- Replaces Mappings-editor-context-level property `hasEnterpriceLicense`\r\nwith plugin-context-level `canUseSyntheticSource` property\r\n- Adds jest tests to check if the synthetic option is correctly\r\ndisplayed based on license\r\n- Improves readability of serializer logic for the source field\r\n\r\n\r\n**How to test:**\r\nThe same test instructions from\r\nhttps://github.com//pull/199854 can be followed with a\r\nfocus on checking that the synthetic option is only available in\r\nEnterprise license.","sha":"762bb7f59d1d980aa34358c62ae0ef53e81f726e","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.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","v8.18.0"],"title":"[Mappings editor] Add code improvements for source field","number":201188,"url":"https://github.com/elastic/kibana/pull/201188","mergeCommit":{"message":"[Mappings editor] Add code improvements for source field (#201188)\n\nCloses https://github.com/elastic/kibana/issues/200769\r\n\r\n## Summary\r\n\r\nThis PR is a follow-up to https://github.com/elastic/kibana/pull/199854\r\nand it adds the following code improvements:\r\n\r\n- Replaces Mappings-editor-context-level property `hasEnterpriceLicense`\r\nwith plugin-context-level `canUseSyntheticSource` property\r\n- Adds jest tests to check if the synthetic option is correctly\r\ndisplayed based on license\r\n- Improves readability of serializer logic for the source field\r\n\r\n\r\n**How to test:**\r\nThe same test instructions from\r\nhttps://github.com//pull/199854 can be followed with a\r\nfocus on checking that the synthetic option is only available in\r\nEnterprise license.","sha":"762bb7f59d1d980aa34358c62ae0ef53e81f726e"}},"sourceBranch":"main","suggestedTargetBranches":["8.17","8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/201188","number":201188,"mergeCommit":{"message":"[Mappings editor] Add code improvements for source field (#201188)\n\nCloses https://github.com/elastic/kibana/issues/200769\r\n\r\n## Summary\r\n\r\nThis PR is a follow-up to https://github.com/elastic/kibana/pull/199854\r\nand it adds the following code improvements:\r\n\r\n- Replaces Mappings-editor-context-level property `hasEnterpriceLicense`\r\nwith plugin-context-level `canUseSyntheticSource` property\r\n- Adds jest tests to check if the synthetic option is correctly\r\ndisplayed based on license\r\n- Improves readability of serializer logic for the source field\r\n\r\n\r\n**How to test:**\r\nThe same test instructions from\r\nhttps://github.com//pull/199854 can be followed with a\r\nfocus on checking that the synthetic option is only available in\r\nEnterprise license.","sha":"762bb7f59d1d980aa34358c62ae0ef53e81f726e"}},{"branch":"8.17","label":"v8.17.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.x","label":"v8.18.0","branchLabelMappingKey":"^v8.18.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Elena Stoeva <[email protected]>
Closes elastic#198621 ## Summary This PR adds support for the synthetic _source field in the mappings Advanced options. Stored option: <img width="1184" alt="Screenshot 2024-11-14 at 19 19 19" src="https://github.com/user-attachments/assets/086f7a3e-9ca1-42de-9f9c-d3599d839ccf"> Synthetic option selected: <img width="1184" alt="Screenshot 2024-11-14 at 19 19 27" src="https://github.com/user-attachments/assets/3700bced-212a-4378-b51a-ab7a0f4f7b99"> Disabled option selected: <img width="1184" alt="Screenshot 2024-11-14 at 19 19 36" src="https://github.com/user-attachments/assets/c7ddcbae-7c78-4477-824e-99b144a1f750"> https://github.com/user-attachments/assets/399d0f95-a5dd-4874-bb8c-e95d6ed38465 How to test: 1. Start Es with `yarn es snapshot --license` (we need Enterprise license to see the Synthetic source option) and Kibana with `yarn start` 2. Go to Index templates/Component templates and start creating a template 3. At the Mappings step, go to Advanced options. 4. Verify that selecting a _source field option translates to the correct Es request. 5. In Index templates form, verify that the default _source option depends on the index mode selected in the Logistics step. For LogsDB and Time series index mode, the default should be synthetic mode; otherwise, the stored option. 6. Verify that in Basic license, the synthetic option is not displayed. ### Checklist - [x] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md) - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [x] Any UI touched in this PR is usable by keyboard only (learn more about [keyboard accessibility](https://webaim.org/techniques/keyboard/)) - [x] Any UI touched in this PR does not create any new axe failures (run axe in browser: [FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/), [Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US)) - [x] This renders correctly on smaller devices using a responsive layout. (You can test this [in your browser](https://www.browserstack.com/guide/responsive-testing-on-local-server)) - [x] This was checked for [cross-browser compatibility](https://www.elastic.co/support/matrix#matrix_browsers) --------- Co-authored-by: kibanamachine <[email protected]>
) Closes elastic#200769 ## Summary This PR is a follow-up to elastic#199854 and it adds the following code improvements: - Replaces Mappings-editor-context-level property `hasEnterpriceLicense` with plugin-context-level `canUseSyntheticSource` property - Adds jest tests to check if the synthetic option is correctly displayed based on license - Improves readability of serializer logic for the source field **How to test:** The same test instructions from elastic#199854 can be followed with a focus on checking that the synthetic option is only available in Enterprise license.
Closes elastic#198621 ## Summary This PR adds support for the synthetic _source field in the mappings Advanced options. Stored option: <img width="1184" alt="Screenshot 2024-11-14 at 19 19 19" src="https://github.com/user-attachments/assets/086f7a3e-9ca1-42de-9f9c-d3599d839ccf"> Synthetic option selected: <img width="1184" alt="Screenshot 2024-11-14 at 19 19 27" src="https://github.com/user-attachments/assets/3700bced-212a-4378-b51a-ab7a0f4f7b99"> Disabled option selected: <img width="1184" alt="Screenshot 2024-11-14 at 19 19 36" src="https://github.com/user-attachments/assets/c7ddcbae-7c78-4477-824e-99b144a1f750"> https://github.com/user-attachments/assets/399d0f95-a5dd-4874-bb8c-e95d6ed38465 How to test: 1. Start Es with `yarn es snapshot --license` (we need Enterprise license to see the Synthetic source option) and Kibana with `yarn start` 2. Go to Index templates/Component templates and start creating a template 3. At the Mappings step, go to Advanced options. 4. Verify that selecting a _source field option translates to the correct Es request. 5. In Index templates form, verify that the default _source option depends on the index mode selected in the Logistics step. For LogsDB and Time series index mode, the default should be synthetic mode; otherwise, the stored option. 6. Verify that in Basic license, the synthetic option is not displayed. ### Checklist - [x] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md) - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [x] Any UI touched in this PR is usable by keyboard only (learn more about [keyboard accessibility](https://webaim.org/techniques/keyboard/)) - [x] Any UI touched in this PR does not create any new axe failures (run axe in browser: [FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/), [Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US)) - [x] This renders correctly on smaller devices using a responsive layout. (You can test this [in your browser](https://www.browserstack.com/guide/responsive-testing-on-local-server)) - [x] This was checked for [cross-browser compatibility](https://www.elastic.co/support/matrix#matrix_browsers) --------- Co-authored-by: kibanamachine <[email protected]>
) Closes elastic#200769 ## Summary This PR is a follow-up to elastic#199854 and it adds the following code improvements: - Replaces Mappings-editor-context-level property `hasEnterpriceLicense` with plugin-context-level `canUseSyntheticSource` property - Adds jest tests to check if the synthetic option is correctly displayed based on license - Improves readability of serializer logic for the source field **How to test:** The same test instructions from elastic#199854 can be followed with a focus on checking that the synthetic option is only available in Enterprise license.
Closes #198621
Summary
This PR adds support for the synthetic _source field in the mappings Advanced options.
Stored option:
Synthetic option selected:
Disabled option selected:
synthetic_source.mov
How to test:
yarn es snapshot --license
(we need Enterprise license to see the Synthetic source option) and Kibana withyarn start
Checklist