-
Notifications
You must be signed in to change notification settings - Fork 8.5k
Description
Currently, the search service exposes a similar API on the client (via registerMountContext) and on the server (via registerRouteHandlerContext).
However, the service registered on each of these varies in an important way, which is that the logic and parameters that are added to the request by the client-side search strategies (when calling search client-side via mount context) will not be added when calling search server-side via route context.
Specifically, the following client-side logic which sets preference will not properly be added when using the server-side APIs:
kibana/src/plugins/data/public/search/es_search/es_search_strategy.ts
Lines 32 to 36 in 5d50141
| if (typeof request.params.preference === 'undefined') { | |
| const setPreference = context.core.uiSettings.get('courier:setRequestPreference'); | |
| const customPreference = context.core.uiSettings.get('courier:customRequestPreference'); | |
| request.params.preference = getEsPreference(setPreference, customPreference); | |
| } |
We need to move this logic into the server-side search strategy so that the APIs exposed in both places will function equivalently.
This is prerequisite to allow expressions to run server side (#46906) since esaggs will rely on the search service.