Open cnasikas opened 1 year ago
Pinging @elastic/response-ops-cases (Feature:Cases)
Pinging @elastic/response-ops (Team:ResponseOps)
We would like to offer the ability to provide suggestions to the users. Suggestions can include:
I think this is the ideal use case for the hint.uids
parameter exposed via Elasticsearch Suggest User Profiles API, I filed https://github.com/elastic/kibana/issues/142327 to re-expose this parameter from the Kibana API counterpart.
Another solution would be to not use the hint, prefetch the user profiles of the suggested users (using the bulkGet API), and pass them to UserProfilesPopover
That could work, but I'd still prefer suggest
API with hints as it can boost returned results based on the last login time and, potentially, other factors in the future that we can find useful.
A third solution is to use a combination of both solutions.
It's probably what you'll end up with in the end anyway assuming you want to always display the current user as the first suggestion. The hint.uids
doesn't have a notion of the current user so it will respect only the last login time while scoring the results (with the empty name
), and it might happen so that the other users logged in after the current one and hence will be ranked higher:
const suggestions = [
await userProfiles.getCurrent(...),
...(await userProfiles.suggest({ name: '', hints: { uids: ['u_xxx_0', 'u_yyy_0'] } }));
];
In 8.5, we added the ability to assign users to a case. Users can open a popover and search for potential assignees. The popover does not offer any suggestions. We would like to offer the ability to provide suggestions to the users. Suggestions can include:
To search for users we use the
suggest
API provided by the security team. One way to provide suggestions is to use thehint
parameter which currently is not exposed by the API in Kibana. Thehint
will contain all theuids
of the suggested users. Then we can pass the hint results asdefaultOptions
in theUserProfilesPopover
component. Another solution would be to not use thehint
, prefetch the user profiles of the suggested users (using thebulkGet
API), and pass them toUserProfilesPopover
. If we go withhint
we need to ensure that a search result with an empty string (this request is being made when the user opens the popover to search) respects thehint
and returns the suggested users. A third solution is to use a combination of both solutions.