-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
Sort server-side in SavedObject export #55128
Conversation
Pinging @elastic/kibana-platform (Team:Platform) |
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've asked Mike Cote to take a look as well, but my guess is this was only added to produce stable exports.
The sort by _id was there to solve this issue #29747. Though for now since we're loading them all at the same time, we could just do so on the server side or drop the this feature overall. |
If this feature was requested by users we should rather keep it by doing a server-side sort. We would eventually like to stream these results to support huge exports but there's no immediate timeline for implementing that. |
Sorting/Aggregating by _id was removed in elastic#52517 Retains sorting as requested by elastic#29747 Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
6e17407
to
0c735e1
Compare
Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
@elasticmachine merge upstream |
I have update to sort server-side. I think doing this with ES does make more sense, but we would need another field to sort-by. We need to either copy |
src/core/server/saved_objects/export/get_sorted_objects_for_export.ts
Outdated
Show resolved
Hide resolved
This sounds like a good idea. |
Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
90daef0
to
4935025
Compare
Discussed with @mikecote who recommended we just sort the ES response in |
@@ -399,6 +393,79 @@ describe('getSortedObjectsForExport()', () => { | |||
).rejects.toThrowErrorMatchingInlineSnapshot(`"Can't export more than 1 objects"`); | |||
}); | |||
|
|||
test('sorts objects within type', async () => { | |||
savedObjectsClient.find.mockResolvedValueOnce({ |
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.
There previously was only coverage when objects were provided, resulting in the bulk request - so this also has the benefit of including that path using find.
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.
Discussed with @mikecote who recommended we just sort the ES response in fetchObjectsToExport where the ES sort was removed. sortObjects is sorting for priority of dependencies, which will take precedence but still result in consistent results.
Ah I missed that 👍
src/core/server/saved_objects/export/get_sorted_objects_for_export.ts
Outdated
Show resolved
Hide resolved
Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
💚 Build SucceededHistory
To update your PR or re-run it, just comment with: |
* master: (31 commits) [SIEM] Overview page feedback (elastic#56261) refactor (elastic#56131) [NP Cleanup] Remove ui/public/inspector (elastic#55677) [SIEM] [TIMELINE] Only add endpoint logo when on event.module === endgame (elastic#56263) Basic Functionality Alert List (elastic#55800) [SIEM] Fix filters on Hosts and Network page (elastic#56234) [SIEM] Adds ability to infer the newsfeed.enabled setting (elastic#56236) [SIEM][Detection Engine] critical blocker for updated rules [SIEM][Detection Engine] critical blocker, fixes ordering issue that causes rules to not run the first time [SIEM] Add link to endpoint app through reference.url (elastic#56211) [Metrics UI] Fixing title truncation in Metrics Explorer (elastic#55917) [SIEM] Put the notice for rules in comment block (elastic#56123) [SIEM][Detection Engine] critical blocker with the UI crashing Consistent timeouts for the Space onPostAuth interceptor tests (elastic#56158) Skip tests that depend on other skipped test [SIEM] [Detection Engine] Timestamps for rules (elastic#56197) Sort server-side in SavedObject export (elastic#55128) [Reporting] Document the 8.0 breaking changes (elastic#56187) Revert "[Monitoring] Change all configs to `monitoring.*`" (elastic#56214) add owners for es_archiver (elastic#56184) ...
@mikecote, do you want this backported to 7.x - or just leave it at 8.0? |
I don't see why not, might as well backport this to 7.x. |
Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
Sorting/Aggregating by _id was removed in #52517
I am not seeing a reason yet as to why the sorting here is necessary as we never perform additional fetches of the data outside of
exportSizeLimit
which would require consistent sorting.cc: @rudolf