-
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
Saved objects import - inconsistent handling of missing references #43873
Comments
Pinging @elastic/kibana-platform |
Looking at the code this looks like a intentional design decision https://github.com/elastic/kibana/blob/master/src/core/server/saved_objects/import/validate_references.ts#L24 @mikecote Was there a reason we don't try to resolve all references regardless of the saved object type? |
From what I recall, this was for scope reduction. I decided to get feature parity with the legacy import which only made sure index patterns existed. I think index patterns were more important to check as Kibana would crash severely when they're missing. Other types of saved object would just cause errors when loading the app (same state as they would be when exporting and including dependencies). The other portion would be having to design a UI / UX around other missing references (or maybe just ask if they still want to import object x?). |
Can you expand on why you think this should be possible? Allowing Saved Objects with missing references essentially removes some data integrity guarantees. Kibana breaks in awkward ways when references don't exist which creates hard to diagnose support cases / bugs or just a general bad experience for users. We'd need to do a lot to get to this point, but it would be really nice if a Saved Object library consumer could trust that their object references would always be intact. The only "excuse" for a missing reference would be a sysadmin fiddling with data in the .kibana index. |
Sure! This may be a bit contrived, but here's a scenario: a well-informed user might be in the process of trying to setup a new Space by copying specific saved objects over to it. For example, a dashboard with a number of visualizations, which reference an index pattern. Maybe this index pattern is overly complex for the new space, with scripted fields and custom formatters that the dashboard in question doesn't take advantage of. The user knows they'll have to re-associate the visualizations to the new index pattern at some point, but perhaps they aren't ready for that just yet.
I agree 100%, but Kibana's story around data integrity isn't consistent at this point. Most of Kibana doesn't enforce referential integrity today, which does lead to bugs and a poor user experience. I think it's more aggravating that certain operations enforce these integrity checks, while others don't. For example, there is nothing stopping you from deleting an index pattern via the documented Saved Objects API, even if it's in use. Same goes for the Saved Objects Management UI today -- we allow this to happen without so much as a warning to the end-user. Visualizations and saved searches have a similar story. I think in an ideal world, the default behavior would be to enforce these integrity checks, but allow consumers to override this behavior if they absolutely need to. Most users will benefit from these integrity checks, but power users will sometimes need Kibana to "get out of their way" in order to solve whatever problem they're having. |
Not a high priority right now, but for reference, this blocks the following enhancements: |
#62553 will partially resolve this issue.
I don't believe this is 100% true. Currently, a " kibana/src/core/server/saved_objects/import/validate_references.ts Lines 118 to 134 in 8a4daff
For the following scenario:
If index-pattern 'baz' does not exist, then search 'bar' will result in a The PR linked above changes import behavior to block any object from being created if a resolvable error is detected (that is: Proposal 1: Proposal 2: Proposal 3: I am leaning towards Proposal 3. Edit: Proposal 2 gets us closer to our end state of allowing users to actually resolve |
The Saved Objects Import API (and corresponding UI feature) attempts to identify missing references when importing objects. For example, the import will fail with a
missing_references
error when importing avisualization
which references anindex-pattern
that doesn't exist.This check currently works for direct references of
index-pattern
s andsearch
objects, but it does not handle references of any other saved object type, and it also doesn't handle transitive references.For example, the API allows for dashboards to be imported which reference non-existent visualizations.
Similarly, the API allows for dashboards to be imported which reference a visualization which in turn references a non-existent index pattern.
Ideally, I think the missing references should handle transient references, and references to other saved object types besides
index-pattern
andsearch
. I think this should also be an optional condition. The API should allow users to copy the object knowing full well that the reference is missing, if they choose to ignore this warning.Blocks:
The text was updated successfully, but these errors were encountered: