-
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
[Security Solution][Data Quality Dashboard][Serverless] Fix fetchAvailableIndices in get_index_stats #197065
[Security Solution][Data Quality Dashboard][Serverless] Fix fetchAvailableIndices in get_index_stats #197065
Conversation
Pinging @elastic/security-threat-hunting (Team:Threat Hunting) |
Pinging @elastic/security-threat-hunting-explore (Team:Threat Hunting:Explore) |
return { | ||
aggregations: { | ||
index: { | ||
buckets: filteredIndices.map((indexInfo) => ({ | ||
key: indexInfo.index, | ||
})), | ||
}, | ||
}, | ||
}; |
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 think we can make it simpler and return an array here, as we are no longer doing any aggregation in the query
filteredIndices.map((indexInfo) => ({
key: indexInfo.index,
}))
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.
Can we also deploy this PR to the cloud and check it again before merge?
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.
Yes also saw that after push and started simplifying. Thanks for catching tho.
I will add the label. Thanks
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.
done
0019272
to
a29630f
Compare
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.
LGTM
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 for fixing this 👍 👍 👍
…lableIndices in get_index_stats addresses elastic#196528 - Remove unused get_available_indices.ts params helper file. - Change fetchAvailableIndices to use creation_date from _cat api instead of targeting @timestamp field of indices
…ange regardless of creation date Previously, `fetchAvailableIndices` only considered indices whose creation dates fell within the specified date range. This missed indices that were created outside the date range but contained data within it. This fix updates the function to also include indices that have data within the specified date range by performing an additional search aggregation. - Return back `getRequestBody` helper to build the search request for fetching indices with data in range. - Improve error handling for invalid date formats with more specific messages. - Update tests to reflect the new logic and error messages.
a29630f
to
64ea911
Compare
💛 Build succeeded, but was flaky
Failed CI StepsTest Failures
Metrics [docs]
History
cc @kapral18 |
Starting backport for target branches: 8.x |
…lableIndices in get_index_stats (elastic#197065) addresses elastic#196528 - Remove unused get_available_indices.ts params helper file. - Change fetchAvailableIndices to use creation_date from _cat api instead of targeting @timestamp field of indices ## UI Changes: Before: ![image](https://github.com/user-attachments/assets/1954a8b6-1760-4ec7-b3d3-167b724f8b3c) After: ![image](https://github.com/user-attachments/assets/232674a1-9691-4d49-862e-99873f22c3cf) --------- Co-authored-by: kibanamachine <[email protected]> (cherry picked from commit ac013b4)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…chAvailableIndices in get_index_stats (#197065) (#198525) # Backport This will backport the following commits from `main` to `8.x`: - [[Security Solution][Data Quality Dashboard][Serverless] Fix fetchAvailableIndices in get_index_stats (#197065)](#197065) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Karen Grigoryan","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-10-31T13:07:36Z","message":"[Security Solution][Data Quality Dashboard][Serverless] Fix fetchAvailableIndices in get_index_stats (#197065)\n\naddresses #196528\r\n\r\n- Remove unused get_available_indices.ts params helper file.\r\n- Change fetchAvailableIndices to use creation_date from _cat api\r\ninstead of targeting @timestamp field of indices\r\n\r\n## UI Changes:\r\n\r\nBefore:\r\n\r\n![image](https://github.com/user-attachments/assets/1954a8b6-1760-4ec7-b3d3-167b724f8b3c)\r\nAfter:\r\n\r\n![image](https://github.com/user-attachments/assets/232674a1-9691-4d49-862e-99873f22c3cf)\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <[email protected]>","sha":"ac013b4a99d68ac1596a19d94a7094b4284a200a","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","Team:Threat Hunting","Team:Threat Hunting:Explore","backport:prev-minor","ci:project-deploy-security"],"title":"[Security Solution][Data Quality Dashboard][Serverless] Fix fetchAvailableIndices in get_index_stats","number":197065,"url":"https://github.com/elastic/kibana/pull/197065","mergeCommit":{"message":"[Security Solution][Data Quality Dashboard][Serverless] Fix fetchAvailableIndices in get_index_stats (#197065)\n\naddresses #196528\r\n\r\n- Remove unused get_available_indices.ts params helper file.\r\n- Change fetchAvailableIndices to use creation_date from _cat api\r\ninstead of targeting @timestamp field of indices\r\n\r\n## UI Changes:\r\n\r\nBefore:\r\n\r\n![image](https://github.com/user-attachments/assets/1954a8b6-1760-4ec7-b3d3-167b724f8b3c)\r\nAfter:\r\n\r\n![image](https://github.com/user-attachments/assets/232674a1-9691-4d49-862e-99873f22c3cf)\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <[email protected]>","sha":"ac013b4a99d68ac1596a19d94a7094b4284a200a"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/197065","number":197065,"mergeCommit":{"message":"[Security Solution][Data Quality Dashboard][Serverless] Fix fetchAvailableIndices in get_index_stats (#197065)\n\naddresses #196528\r\n\r\n- Remove unused get_available_indices.ts params helper file.\r\n- Change fetchAvailableIndices to use creation_date from _cat api\r\ninstead of targeting @timestamp field of indices\r\n\r\n## UI Changes:\r\n\r\nBefore:\r\n\r\n![image](https://github.com/user-attachments/assets/1954a8b6-1760-4ec7-b3d3-167b724f8b3c)\r\nAfter:\r\n\r\n![image](https://github.com/user-attachments/assets/232674a1-9691-4d49-862e-99873f22c3cf)\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <[email protected]>","sha":"ac013b4a99d68ac1596a19d94a7094b4284a200a"}}]}] BACKPORT--> Co-authored-by: Karen Grigoryan <[email protected]>
…lableIndices in get_index_stats (elastic#197065) addresses elastic#196528 - Remove unused get_available_indices.ts params helper file. - Change fetchAvailableIndices to use creation_date from _cat api instead of targeting @timestamp field of indices ## UI Changes: Before: ![image](https://github.com/user-attachments/assets/1954a8b6-1760-4ec7-b3d3-167b724f8b3c) After: ![image](https://github.com/user-attachments/assets/232674a1-9691-4d49-862e-99873f22c3cf) --------- Co-authored-by: kibanamachine <[email protected]> (cherry picked from commit ac013b4)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…tchAvailableIndices in get_index_stats (#197065) (#200551) # Backport This will backport the following commits from `main` to `8.16`: - [[Security Solution][Data Quality Dashboard][Serverless] Fix fetchAvailableIndices in get_index_stats (#197065)](#197065) <!--- Backport version: 8.9.8 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Karen Grigoryan","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-10-31T13:07:36Z","message":"[Security Solution][Data Quality Dashboard][Serverless] Fix fetchAvailableIndices in get_index_stats (#197065)\n\naddresses #196528\r\n\r\n- Remove unused get_available_indices.ts params helper file.\r\n- Change fetchAvailableIndices to use creation_date from _cat api\r\ninstead of targeting @timestamp field of indices\r\n\r\n## UI Changes:\r\n\r\nBefore:\r\n\r\n![image](https://github.com/user-attachments/assets/1954a8b6-1760-4ec7-b3d3-167b724f8b3c)\r\nAfter:\r\n\r\n![image](https://github.com/user-attachments/assets/232674a1-9691-4d49-862e-99873f22c3cf)\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <[email protected]>","sha":"ac013b4a99d68ac1596a19d94a7094b4284a200a","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","Team:Threat Hunting","Team:Threat Hunting:Explore","backport:prev-minor","ci:project-deploy-security","v8.17.0"],"number":197065,"url":"https://github.com/elastic/kibana/pull/197065","mergeCommit":{"message":"[Security Solution][Data Quality Dashboard][Serverless] Fix fetchAvailableIndices in get_index_stats (#197065)\n\naddresses #196528\r\n\r\n- Remove unused get_available_indices.ts params helper file.\r\n- Change fetchAvailableIndices to use creation_date from _cat api\r\ninstead of targeting @timestamp field of indices\r\n\r\n## UI Changes:\r\n\r\nBefore:\r\n\r\n![image](https://github.com/user-attachments/assets/1954a8b6-1760-4ec7-b3d3-167b724f8b3c)\r\nAfter:\r\n\r\n![image](https://github.com/user-attachments/assets/232674a1-9691-4d49-862e-99873f22c3cf)\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <[email protected]>","sha":"ac013b4a99d68ac1596a19d94a7094b4284a200a"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","labelRegex":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/197065","number":197065,"mergeCommit":{"message":"[Security Solution][Data Quality Dashboard][Serverless] Fix fetchAvailableIndices in get_index_stats (#197065)\n\naddresses #196528\r\n\r\n- Remove unused get_available_indices.ts params helper file.\r\n- Change fetchAvailableIndices to use creation_date from _cat api\r\ninstead of targeting @timestamp field of indices\r\n\r\n## UI Changes:\r\n\r\nBefore:\r\n\r\n![image](https://github.com/user-attachments/assets/1954a8b6-1760-4ec7-b3d3-167b724f8b3c)\r\nAfter:\r\n\r\n![image](https://github.com/user-attachments/assets/232674a1-9691-4d49-862e-99873f22c3cf)\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <[email protected]>","sha":"ac013b4a99d68ac1596a19d94a7094b4284a200a"}},{"branch":"8.x","label":"v8.17.0","labelRegex":"^v8.17.0$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/198525","number":198525,"state":"MERGED","mergeCommit":{"sha":"0a561873792de54c5266884a47a0e0819dc7aea3","message":"[8.x] [Security Solution][Data Quality Dashboard][Serverless] Fix fetchAvailableIndices in get_index_stats (#197065) (#198525)\n\n# Backport\n\nThis will backport the following commits from `main` to `8.x`:\n- [[Security Solution][Data Quality Dashboard][Serverless] Fix\nfetchAvailableIndices in get_index_stats\n(#197065)](https://github.com/elastic/kibana/pull/197065)\n\n<!--- Backport version: 9.4.3 -->\n\n### Questions ?\nPlease refer to the [Backport tool\ndocumentation](https://github.com/sqren/backport)\n\n<!--BACKPORT [{\"author\":{\"name\":\"Karen\nGrigoryan\",\"email\":\"[email protected]\"},\"sourceCommit\":{\"committedDate\":\"2024-10-31T13:07:36Z\",\"message\":\"[Security\nSolution][Data Quality Dashboard][Serverless] Fix fetchAvailableIndices\nin get_index_stats (#197065)\\n\\naddresses #196528\\r\\n\\r\\n- Remove unused\nget_available_indices.ts params helper file.\\r\\n- Change\nfetchAvailableIndices to use creation_date from _cat api\\r\\ninstead of\ntargeting @timestamp field of indices\\r\\n\\r\\n## UI\nChanges:\\r\\n\\r\\nBefore:\\r\\n\\r\\n![image](https://github.com/user-attachments/assets/1954a8b6-1760-4ec7-b3d3-167b724f8b3c)\\r\\nAfter:\\r\\n\\r\\n![image](https://github.com/user-attachments/assets/232674a1-9691-4d49-862e-99873f22c3cf)\\r\\n\\r\\n---------\\r\\n\\r\\nCo-authored-by:\nkibanamachine\n<[email protected]>\",\"sha\":\"ac013b4a99d68ac1596a19d94a7094b4284a200a\",\"branchLabelMapping\":{\"^v9.0.0$\":\"main\",\"^v8.17.0$\":\"8.x\",\"^v(\\\\d+).(\\\\d+).\\\\d+$\":\"$1.$2\"}},\"sourcePullRequest\":{\"labels\":[\"release_note:skip\",\"v9.0.0\",\"Team:Threat\nHunting\",\"Team:Threat\nHunting:Explore\",\"backport:prev-minor\",\"ci:project-deploy-security\"],\"title\":\"[Security\nSolution][Data Quality Dashboard][Serverless] Fix fetchAvailableIndices\nin\nget_index_stats\",\"number\":197065,\"url\":\"https://github.com/elastic/kibana/pull/197065\",\"mergeCommit\":{\"message\":\"[Security\nSolution][Data Quality Dashboard][Serverless] Fix fetchAvailableIndices\nin get_index_stats (#197065)\\n\\naddresses #196528\\r\\n\\r\\n- Remove unused\nget_available_indices.ts params helper file.\\r\\n- Change\nfetchAvailableIndices to use creation_date from _cat api\\r\\ninstead of\ntargeting @timestamp field of indices\\r\\n\\r\\n## UI\nChanges:\\r\\n\\r\\nBefore:\\r\\n\\r\\n![image](https://github.com/user-attachments/assets/1954a8b6-1760-4ec7-b3d3-167b724f8b3c)\\r\\nAfter:\\r\\n\\r\\n![image](https://github.com/user-attachments/assets/232674a1-9691-4d49-862e-99873f22c3cf)\\r\\n\\r\\n---------\\r\\n\\r\\nCo-authored-by:\nkibanamachine\n<[email protected]>\",\"sha\":\"ac013b4a99d68ac1596a19d94a7094b4284a200a\"}},\"sourceBranch\":\"main\",\"suggestedTargetBranches\":[],\"targetPullRequestStates\":[{\"branch\":\"main\",\"label\":\"v9.0.0\",\"branchLabelMappingKey\":\"^v9.0.0$\",\"isSourceBranch\":true,\"state\":\"MERGED\",\"url\":\"https://github.com/elastic/kibana/pull/197065\",\"number\":197065,\"mergeCommit\":{\"message\":\"[Security\nSolution][Data Quality Dashboard][Serverless] Fix fetchAvailableIndices\nin get_index_stats (#197065)\\n\\naddresses #196528\\r\\n\\r\\n- Remove unused\nget_available_indices.ts params helper file.\\r\\n- Change\nfetchAvailableIndices to use creation_date from _cat api\\r\\ninstead of\ntargeting @timestamp field of indices\\r\\n\\r\\n## UI\nChanges:\\r\\n\\r\\nBefore:\\r\\n\\r\\n![image](https://github.com/user-attachments/assets/1954a8b6-1760-4ec7-b3d3-167b724f8b3c)\\r\\nAfter:\\r\\n\\r\\n![image](https://github.com/user-attachments/assets/232674a1-9691-4d49-862e-99873f22c3cf)\\r\\n\\r\\n---------\\r\\n\\r\\nCo-authored-by:\nkibanamachine\n<[email protected]>\",\"sha\":\"ac013b4a99d68ac1596a19d94a7094b4284a200a\"}}]}]\nBACKPORT-->\n\nCo-authored-by: Karen Grigoryan <[email protected]>"}}]}] BACKPORT-->
addresses #196528
UI Changes:
Before:
After: