-
Notifications
You must be signed in to change notification settings - Fork 8k
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
[Playground] Fix Context field extraction #183217
[Playground] Fix Context field extraction #183217
Conversation
typeof this.content_field === 'string' | ||
? this.content_field | ||
: this.content_field[hit._index as string]; | ||
|
||
// field values can be a single item array or plain text, that is why needed to check the types before accessing the field | ||
pageContentFieldKey = Array.isArray(pageContentFieldKey) |
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.
@joemcelroy: I am getting two sets of input into this function.
- Getting object notation
{ index: 'field', website: 'body_content' }
from conversation_chain.test.ts - From UI Array notation
{'index_name' :['field_name
]}`
Please let me know if this is expected.
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.
the retriever should expect a type of Record<string, string>
- an object where the key is the index name and the value is the field name.
UI is built for a time when we have multiple fields that can be selected. What should happen is that the UI input is converted into the above, picking the first field in the array. This should be updated in the route.ts.
Im surprised the route didn't throw an API validation error. Its currently only accepting a string.
need a test in conversational_chain to verify this. otherwise looks good so far :) |
797098b
to
91499d5
Compare
}, | ||
], | ||
// @ts-ignore | ||
{ index: ['field'], website: ['body_content'] } |
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.
This should be converted to { index: "field", website: 'body_content' }
. You want to be converting the array of fields into a single value in the route.ts file.
Second you want this new test that is able to read a field value thats is in an object, to verify the fix. For example index: "parent.field".
x-pack/plugins/search_playground/server/lib/conversational_chain.test.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/search_playground/server/lib/conversational_chain.test.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/search_playground/server/lib/conversational_chain.test.ts
Outdated
Show resolved
Hide resolved
💚 Build Succeeded
Metrics [docs]
History
To update your PR or re-run it, just comment with: |
## Summary Currently, Nested fields are not being parsed correctly. Due to that, `context` is showing empty in list of the documents retrieved flyout. This PR includes a fix for the nested fields parsing issue. ### UI (Stack): <img width="1507" alt="Screenshot 2024-05-10 at 2 51 53 PM" src="https://github.com/elastic/kibana/assets/150824886/d298a673-595c-41b7-a7d6-600cfca0ea1b"> <img width="1512" alt="Screenshot 2024-05-10 at 2 52 09 PM" src="https://github.com/elastic/kibana/assets/150824886/6d4cf8f4-73e4-47f3-bed7-77f7f8863726"> ### UI (Serverless): ![Screenshot 2024-05-12 at 1 02 43 PM](https://github.com/elastic/kibana/assets/150824886/f0a31056-64dc-409e-80cf-7ad15452a579) ### Checklist Delete any items that are not applicable to this PR. - [ ] 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) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [ ] [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 - [ ] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [ ] Any UI touched in this PR is usable by keyboard only (learn more about [keyboard accessibility](https://webaim.org/techniques/keyboard/)) - [ ] 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)) - [ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - [ ] 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)) - [ ] This was checked for [cross-browser compatibility](https://www.elastic.co/support/matrix#matrix_browsers) ### For maintainers - [ ] This was checked for breaking API changes and was [labeled appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) (cherry picked from commit 58d21ff)
💚 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.14`: - [[Playground] Fix Context field extraction (#183217)](#183217) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Samiul Monir","email":"150824886+Samiul-TheSoccerFan@users.noreply.github.com"},"sourceCommit":{"committedDate":"2024-05-13T21:37:46Z","message":"[Playground] Fix Context field extraction (#183217)\n\n## Summary\r\n\r\nCurrently, Nested fields are not being parsed correctly. Due to that,\r\n`context` is showing empty in list of the documents retrieved flyout.\r\n\r\nThis PR includes a fix for the nested fields parsing issue. \r\n\r\n### UI (Stack):\r\n\r\n<img width=\"1507\" alt=\"Screenshot 2024-05-10 at 2 51 53 PM\"\r\nsrc=\"https://github.com/elastic/kibana/assets/150824886/d298a673-595c-41b7-a7d6-600cfca0ea1b\">\r\n<img width=\"1512\" alt=\"Screenshot 2024-05-10 at 2 52 09 PM\"\r\nsrc=\"https://github.com/elastic/kibana/assets/150824886/6d4cf8f4-73e4-47f3-bed7-77f7f8863726\">\r\n\r\n### UI (Serverless):\r\n![Screenshot 2024-05-12 at 1 02\r\n43 PM](https://github.com/elastic/kibana/assets/150824886/f0a31056-64dc-409e-80cf-7ad15452a579)\r\n\r\n\r\n### Checklist\r\n\r\nDelete any items that are not applicable to this PR.\r\n\r\n- [ ] 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- [ ]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas added for features that require explanation or tutorials\r\n- [ ] [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- [ ] [Flaky Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\r\nused on any tests changed\r\n- [ ] Any UI touched in this PR is usable by keyboard only (learn more\r\nabout [keyboard accessibility](https://webaim.org/techniques/keyboard/))\r\n- [ ] 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- [ ] If a plugin configuration key changed, check if it needs to be\r\nallowlisted in the cloud and added to the [docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\r\n- [ ] 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- [ ] This was checked for [cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)\r\n\r\n\r\n### For maintainers\r\n\r\n- [ ] This was checked for breaking API changes and was [labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"58d21ffb0443e3b5ea99b330fb92f0787221daa0","branchLabelMapping":{"^v8.15.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:EnterpriseSearch","v8.14.0","v8.15.0"],"title":"[Playground] Fix Context field extraction","number":183217,"url":"#183217 Fix Context field extraction (#183217)\n\n## Summary\r\n\r\nCurrently, Nested fields are not being parsed correctly. Due to that,\r\n`context` is showing empty in list of the documents retrieved flyout.\r\n\r\nThis PR includes a fix for the nested fields parsing issue. \r\n\r\n### UI (Stack):\r\n\r\n<img width=\"1507\" alt=\"Screenshot 2024-05-10 at 2 51 53 PM\"\r\nsrc=\"https://github.com/elastic/kibana/assets/150824886/d298a673-595c-41b7-a7d6-600cfca0ea1b\">\r\n<img width=\"1512\" alt=\"Screenshot 2024-05-10 at 2 52 09 PM\"\r\nsrc=\"https://github.com/elastic/kibana/assets/150824886/6d4cf8f4-73e4-47f3-bed7-77f7f8863726\">\r\n\r\n### UI (Serverless):\r\n![Screenshot 2024-05-12 at 1 02\r\n43 PM](https://github.com/elastic/kibana/assets/150824886/f0a31056-64dc-409e-80cf-7ad15452a579)\r\n\r\n\r\n### Checklist\r\n\r\nDelete any items that are not applicable to this PR.\r\n\r\n- [ ] 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- [ ]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas added for features that require explanation or tutorials\r\n- [ ] [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- [ ] [Flaky Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\r\nused on any tests changed\r\n- [ ] Any UI touched in this PR is usable by keyboard only (learn more\r\nabout [keyboard accessibility](https://webaim.org/techniques/keyboard/))\r\n- [ ] 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- [ ] If a plugin configuration key changed, check if it needs to be\r\nallowlisted in the cloud and added to the [docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\r\n- [ ] 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- [ ] This was checked for [cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)\r\n\r\n\r\n### For maintainers\r\n\r\n- [ ] This was checked for breaking API changes and was [labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"58d21ffb0443e3b5ea99b330fb92f0787221daa0"}},"sourceBranch":"main","suggestedTargetBranches":["8.14"],"targetPullRequestStates":[{"branch":"8.14","label":"v8.14.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.15.0","branchLabelMappingKey":"^v8.15.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/183217","number":183217,"mergeCommit":{"message":"[Playground] Fix Context field extraction (#183217)\n\n## Summary\r\n\r\nCurrently, Nested fields are not being parsed correctly. Due to that,\r\n`context` is showing empty in list of the documents retrieved flyout.\r\n\r\nThis PR includes a fix for the nested fields parsing issue. \r\n\r\n### UI (Stack):\r\n\r\n<img width=\"1507\" alt=\"Screenshot 2024-05-10 at 2 51 53 PM\"\r\nsrc=\"https://github.com/elastic/kibana/assets/150824886/d298a673-595c-41b7-a7d6-600cfca0ea1b\">\r\n<img width=\"1512\" alt=\"Screenshot 2024-05-10 at 2 52 09 PM\"\r\nsrc=\"https://github.com/elastic/kibana/assets/150824886/6d4cf8f4-73e4-47f3-bed7-77f7f8863726\">\r\n\r\n### UI (Serverless):\r\n![Screenshot 2024-05-12 at 1 02\r\n43 PM](https://github.com/elastic/kibana/assets/150824886/f0a31056-64dc-409e-80cf-7ad15452a579)\r\n\r\n\r\n### Checklist\r\n\r\nDelete any items that are not applicable to this PR.\r\n\r\n- [ ] 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- [ ]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas added for features that require explanation or tutorials\r\n- [ ] [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- [ ] [Flaky Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\r\nused on any tests changed\r\n- [ ] Any UI touched in this PR is usable by keyboard only (learn more\r\nabout [keyboard accessibility](https://webaim.org/techniques/keyboard/))\r\n- [ ] 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- [ ] If a plugin configuration key changed, check if it needs to be\r\nallowlisted in the cloud and added to the [docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\r\n- [ ] 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- [ ] This was checked for [cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)\r\n\r\n\r\n### For maintainers\r\n\r\n- [ ] This was checked for breaking API changes and was [labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"58d21ffb0443e3b5ea99b330fb92f0787221daa0"}}]}] BACKPORT--> Co-authored-by: Samiul Monir <150824886+Samiul-TheSoccerFan@users.noreply.github.com>
Summary
Currently, Nested fields are not being parsed correctly. Due to that,
context
is showing empty in list of the documents retrieved flyout.This PR includes a fix for the nested fields parsing issue.
UI (Stack):
UI (Serverless):
Checklist
Delete any items that are not applicable to this PR.
For maintainers