-
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
Delete saved objects in bulk #30503
Comments
Pinging @elastic/kibana-app |
Pinging @elastic/kibana-platform |
This seems like a very reasonable request, since there are already bulkCreate, and bulkGet APIs one would assume that there might also be a bulkDelete API. I am guessing that there is not one already because it has not been needed? @epixa Maybe you have some thoughts about this. |
@mohitagrawa1 is it important to delete and recreate the objects? Why not just update the existing ones? |
Yes @spalger, update is an option, using query parameter 'overwrite'. |
I agree, it would be a nice feature to add, just suggesting an alternate solution until a bulk delete is available. |
Thanks :) |
+1 |
1 similar comment
+1 |
We have a use case in search sessions (see #89570). |
@wayneseymour will also need this for changes he's planning to interact with the Saved Objects API directly for functional tests. |
We have an issue open for bulk delete of alerts, part of which would be bulk delete of the alert SOs - #53144 . Though I suspect we won't be needing this for a few more minor releases ... |
@joshdover I believe we have enough use cases to prioratize this. We have a couple of use cases in telemetry that would also greatly benefit from having this api. |
This comment has been minimized.
This comment has been minimized.
The signature of the async delete(type: string, id: string, {refresh, force, namespace}: SavedObjectsDeleteOptions): Promise<{}> To introduce a new One of the notable difference between A draft of the API could look like: interface SavedObjectsBulkDeleteObject {
type: string;
id: string;
}
interface SavedObjectsBulkDeleteOptions extends SavedObjectsBaseOptions {
refresh?: MutatingOperationRefreshSetting;
force?: boolean;
}
interface SavedObjectsBulkDeleteStatus {
success: boolean;
error?: SavedObjectError;
}
interface SavedObjectsBulkDeleteResponse {
statuses: SavedObjectsBulkDeleteStatus[];
}
async bulkDelete(objects: SavedObjectsBulkDeleteObject[], options: SavedObjectsBulkDeleteOptions): Promise<SavedObjectsBulkDeleteResponse>
WDYT? cc @elastic/kibana-security do you have any idea of the cost of implementing this API in the security and spaces wrapper? |
I agree, this feels unnecessary.
I'm torn. The only reason we don't have it for bulkGet yet is because nobody has asked for it. That said, it's easier to omit this if we don't have a legitimate need. It's confusing as a consumer of the SO client because we have an inconsistent story around multi-space support: some functions support it, while others don't.
Spaces wrapper is trivial, and the security wrapper would be a small amount of effort. The largest piece of work would be augmenting the functional test suite to cover this new feature. |
@pgayvallet thanks for drafting this out! I agree to both points; no need for |
+1 |
#136562 is a case where we're trying to use the saved obejcts API instead of the esArchiver in some functional tests but the issue is that the tests create 10k objects for some capacity tests, making this limitation really problematic when we need to cleanup after the test. |
We've been postponing this issue for literally years because we never had any high enough reasons to prioritize it. Seems like #136562 may actually be the |
ATM, there's refactoring in progress that might put a pause on this work: |
Update: Core's going to go ahead with adding the API as soon as we've migrated the relevant part of the SO domain to packages. @elastic/kibana-security I assume we need to take care of any legacy aliases that may exist for multi-namespace type objects being deleted, as we do in the single delete request, or am I completely off the mark here? |
@TinaHeiligers Yes, bulk delete should behave the same as delete with respect to legacy aliases. |
Hii,
I pushing several visualizations, dashboards, savedsearches and scripted fields using a python script. They altogether fulfil one big functionality, thus I refer them as an application.
Now what I want is to update the whole application.
For this, I have written another python script which deletes each and every object previously created and put the newer ones. This script takes a lot of time as there are several delete rest calls ( one for each component ). Also if it fails before complete execution, there are tracing back and rolling back issues.
Thus is there a way in which I can delete these visualizations, dashboards, savedsearches and scripted at once(in other words, upgrade the application in a single go!).
I am using kibana's Delete Object API and Create Object API for deleting and saving the objects.
If I am able to delete the objects using a bulk delete api, it would be very helpful.
The text was updated successfully, but these errors were encountered: