-
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
[Content management] POC for the core (server) #148791
Conversation
…ga/kibana into content-management/core-server-poc
@elasticmachine merge upstream |
…ga/kibana into content-management/core-server-poc # Conflicts:
💔 Build FailedFailed CI Steps
Test Failures
Metrics [docs]Module Count
Async chunks
Page load bundle
Unknown metric groupsasync chunk count
miscellaneous assets size
History
To update your PR or re-run it, just comment with: |
|
||
export interface GetItemStart { | ||
type: 'getItemStart'; | ||
contentId: string; |
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.
Is the contentId
in any way related to a Saved Object id if the content is a saved object? If so, given that we're using the exClient directly, would the Saved Object id be the raw ES id?
Another question related to saved object content types: How are spaces and space-specific objects handled? What about shared saved objects? I guess with shared types we can assume uniqueness.
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.
Is the contentId in any way related to a Saved Object id if the content is a saved object? If so, given that we're using the exClient directly, would the Saved Object id be the raw ES id?
The id
could be directly SO id and thus the raw ES id, yes. For content management it is just a string passed down to the storage layer to retrieve a content.
How are spaces and space-specific objects handled? What about shared saved objects? I guess with shared types we can assume uniqueness.
The CM layer is DB agnostic it does not know about SO. What you are describing is a logic handled by the application. If an application ask to fetch id 1234
, CM will forward that to the storage layer and fetch that content on the storage layer.
For example, we are on space A
and the application fetches object with id 1234
that only exist in space B
, that's an error at the application level. It should not fetch that object. Now, the storage layer has access to the core
http request context so which, from what I understand, provide security and authorization for SO. That context can be leveraged to prevent the above scenario.
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.
directly SO id and thus the raw ES id,
Saved object IDs go through a SavedObjectsSerializer
class that transforms the raw es doc id to an id in the context of Kibana. Hence, a saved object id isn't necessarily the raw es doc Id but you probably know that already.
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.
That is internal to SO and CM does not know (or need to know) about it. Here we are talking about the SO id, if it is equal or not to the raw ES id is internal to SO.
## Summary Partially addresses #149216, #149939 Closes #149217 Setup basic client-side content client (client, cache, react content and hooks) based on the latest API from @sebelga's [server-side and rpc POC](#148791). We assume that the POC isn't far from the initial version that we are going to merge to main Initial content client implementation scope: - We start from using tanstack/query for client side caching, content queuing and mutating . Also use it as a basis for the API. We start from their defaults and will adjust defaults as we go. Basically our content client would be a helpful wrapper around tanstack/query (at least initially) - We start from exposing minimal query lib API surface, but we will gradually expose more as needed - For content retrieval we support promise based, RXJS observable based and react hook based methods - For the RPC/api I copied over the latest from [server-side and rpc POC](#148791) assuming it won't change much. - no optimistic update or automatic invalidation after updates yet (this will be later) - just get and create for now
WIP for the content management core implementation (server side)
Note for reviewers
This is still a work in Progress! 😊
Navigate to "management > kibana > content management" to test the UI
foo
(with an In memory DB) andmaps
. To index the content for maps it currently only works when creating a new map. To index the content forfoo
use the form in the UI.DELETE .kibana-content-mgt
. It will be re-created on the next Kibana server restart.Upcoming work:
I am thinking in requiring a method on the Storage class to be able to retrieve the full content from the DB.
Then, when registering the content we provide the Kibana version we want the content to be indexed from (e.g.
indexContentFrom: "8.8.0"
). --> When doing a stack upgrade we only index the content to the Search index when the new stack equal or greater version declared here.I am thinking in allowing 5 custom metrics (
number
fields in mapping) and 5 custom terms (keyword
fields in mappings) to be passed in the documents. Those fields ("metric1", "metric2", "metric3" ...) will then allow us to render any table list view with custom column for each content (e.g. Files table will be able to sort by file size)