[AI Assistant] Fixed DataClient find method to pass fields param to esClient.msearch#212465
Conversation
| sortOrder: query.sort_order, | ||
| filter: query.filter, | ||
| fields: query.fields, | ||
| fields: query.fields ? transformFieldNamesToSourceScheme(query.fields) : undefined, |
There was a problem hiding this comment.
can you use _.snakeCase from lodash here?
| case 'updatedBy': | ||
| return 'updated_by'; | ||
| case 'timestamp': | ||
| return '@timestamp'; |
There was a problem hiding this comment.
https://www.youtube.com/watch?v=7W0EO6C2sFg
I think it's fine to do snakecase, but we do have some timestamp fields that do not use the @, for example the timestamp field in Message. I don't think we should be adjusting every timestamp field for this rason.
There was a problem hiding this comment.
Agree, I will drop timestamp and just use _.snakeCase from lodash
…data-client-fields-select # Conflicts: # x-pack/solutions/security/plugins/elastic_assistant/server/routes/user_conversations/find_route.ts
….com:YulNaumenko/kibana into fix-assistant-find-data-client-fields-select # Conflicts: # x-pack/solutions/security/plugins/elastic_assistant/server/routes/anonymization_fields/find_route.ts # x-pack/solutions/security/plugins/elastic_assistant/server/routes/knowledge_base/entries/find_route.ts
|
@elasticmachine merge upstream |
| _source: { | ||
| includes: fields, | ||
| }, |
There was a problem hiding this comment.
| _source: { | |
| includes: fields, | |
| }, | |
| _source: fields.length ? { | |
| includes: fields, | |
| } : true, |
|
Starting backport for target branches: 8.x https://github.com/elastic/kibana/actions/runs/13637026001 |
💚 Build Succeeded
Metrics [docs]
History
cc @YulNaumenko |
💔 All backports failed
Manual backportTo create the backport manually run: Questions ?Please refer to the Backport tool documentation |
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…sClient.msearch (elastic#212465) Fixed `AIAssistantDataClient` to send values of the `fields` param if is provided to `esClient.msearch` request. To test run the API query `http://localhost:5601/api/security_ai_assistant/current_user/conversations/_find?page=1&per_page=99&fields=id,users,apiConfig.connectorId` and makes sure the only provided fields are returned in the result. --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> (cherry picked from commit 7afe813) # Conflicts: # x-pack/solutions/security/plugins/elastic_assistant/server/ai_assistant_data_clients/find.ts
…m to esClient.msearch (#212465) (#212983) # Backport This will backport the following commits from `main` to `8.x`: - [[AI Assistant] Fixed DataClient find method to pass fields param to esClient.msearch (#212465)](#212465) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Yuliia Naumenko","email":"jo.naumenko@gmail.com"},"sourceCommit":{"committedDate":"2025-03-03T17:43:16Z","message":"[AI Assistant] Fixed DataClient find method to pass fields param to esClient.msearch (#212465)\n\nFixed `AIAssistantDataClient` to send values of the `fields` param if is\nprovided to `esClient.msearch` request.\n\nTo test run the API query\n`http://localhost:5601/api/security_ai_assistant/current_user/conversations/_find?page=1&per_page=99&fields=id,users,apiConfig.connectorId`\nand makes sure the only provided fields are returned in the result.\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>","sha":"7afe813b35ff4e1cd97be50dbaec2dec554eed26","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:skip","backport:version","v9.1.0","v8.19.0"],"title":"[AI Assistant] Fixed DataClient find method to pass fields param to esClient.msearch","number":212465,"url":"https://github.com/elastic/kibana/pull/212465","mergeCommit":{"message":"[AI Assistant] Fixed DataClient find method to pass fields param to esClient.msearch (#212465)\n\nFixed `AIAssistantDataClient` to send values of the `fields` param if is\nprovided to `esClient.msearch` request.\n\nTo test run the API query\n`http://localhost:5601/api/security_ai_assistant/current_user/conversations/_find?page=1&per_page=99&fields=id,users,apiConfig.connectorId`\nand makes sure the only provided fields are returned in the result.\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>","sha":"7afe813b35ff4e1cd97be50dbaec2dec554eed26"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/212465","number":212465,"mergeCommit":{"message":"[AI Assistant] Fixed DataClient find method to pass fields param to esClient.msearch (#212465)\n\nFixed `AIAssistantDataClient` to send values of the `fields` param if is\nprovided to `esClient.msearch` request.\n\nTo test run the API query\n`http://localhost:5601/api/security_ai_assistant/current_user/conversations/_find?page=1&per_page=99&fields=id,users,apiConfig.connectorId`\nand makes sure the only provided fields are returned in the result.\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>","sha":"7afe813b35ff4e1cd97be50dbaec2dec554eed26"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Yuliia Naumenko <jo.naumenko@gmail.com>
…m to esClient.msearch (elastic#212465) (elastic#212983) # Backport This will backport the following commits from `main` to `8.x`: - [[AI Assistant] Fixed DataClient find method to pass fields param to esClient.msearch (elastic#212465)](elastic#212465) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Yuliia Naumenko","email":"jo.naumenko@gmail.com"},"sourceCommit":{"committedDate":"2025-03-03T17:43:16Z","message":"[AI Assistant] Fixed DataClient find method to pass fields param to esClient.msearch (elastic#212465)\n\nFixed `AIAssistantDataClient` to send values of the `fields` param if is\nprovided to `esClient.msearch` request.\n\nTo test run the API query\n`http://localhost:5601/api/security_ai_assistant/current_user/conversations/_find?page=1&per_page=99&fields=id,users,apiConfig.connectorId`\nand makes sure the only provided fields are returned in the result.\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>","sha":"7afe813b35ff4e1cd97be50dbaec2dec554eed26","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:skip","backport:version","v9.1.0","v8.19.0"],"title":"[AI Assistant] Fixed DataClient find method to pass fields param to esClient.msearch","number":212465,"url":"https://github.com/elastic/kibana/pull/212465","mergeCommit":{"message":"[AI Assistant] Fixed DataClient find method to pass fields param to esClient.msearch (elastic#212465)\n\nFixed `AIAssistantDataClient` to send values of the `fields` param if is\nprovided to `esClient.msearch` request.\n\nTo test run the API query\n`http://localhost:5601/api/security_ai_assistant/current_user/conversations/_find?page=1&per_page=99&fields=id,users,apiConfig.connectorId`\nand makes sure the only provided fields are returned in the result.\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>","sha":"7afe813b35ff4e1cd97be50dbaec2dec554eed26"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/212465","number":212465,"mergeCommit":{"message":"[AI Assistant] Fixed DataClient find method to pass fields param to esClient.msearch (elastic#212465)\n\nFixed `AIAssistantDataClient` to send values of the `fields` param if is\nprovided to `esClient.msearch` request.\n\nTo test run the API query\n`http://localhost:5601/api/security_ai_assistant/current_user/conversations/_find?page=1&per_page=99&fields=id,users,apiConfig.connectorId`\nand makes sure the only provided fields are returned in the result.\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>","sha":"7afe813b35ff4e1cd97be50dbaec2dec554eed26"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Yuliia Naumenko <jo.naumenko@gmail.com>
…sClient.msearch (elastic#212465) Fixed `AIAssistantDataClient` to send values of the `fields` param if is provided to `esClient.msearch` request. To test run the API query `http://localhost:5601/api/security_ai_assistant/current_user/conversations/_find?page=1&per_page=99&fields=id,users,apiConfig.connectorId` and makes sure the only provided fields are returned in the result. --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Fixed
AIAssistantDataClientto send values of thefieldsparam if is provided toesClient.msearchrequest.To test run the API query
http://localhost:5601/api/security_ai_assistant/current_user/conversations/_find?page=1&per_page=99&fields=id,users,apiConfig.connectorIdand makes sure the only provided fields are returned in the result.