Open
Description
openedon Jul 5, 2023
Currently, registering a custom search strategy requires the following:
registerSearchStrategy: <
SearchStrategyRequest extends IKibanaSearchRequest = IEsSearchRequest,
SearchStrategyResponse extends IKibanaSearchResponse = IEsSearchResponse
>(
name: string,
strategy: ISearchStrategy<SearchStrategyRequest, SearchStrategyResponse>
) => void;
The search strategy itself requires only a search
method, and optionally accepts a cancel
and extend
method.
Right now, when using the data.search
client-side services, the internal/search
routes will be called, which have little schema validation:
{
request: {
params: schema.object({
strategy: schema.string(),
id: schema.maybe(schema.string()),
}),
body: schema.object(
// ...
{ unknowns: 'allow' }
),
},
}
We're already using Typescript generics for registering/calling the search strategies, so we should already have some definition for the expected types of the request/response shape. It would be nice if we actually added validation to ensure the request/response shape are what is expected.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Metadata
Assignees
Labels
Querying infrastructure in KibanaDiscover App Team (Document Explorer, Saved Search, Surrounding documents, Data, DataViews)Addressing this issue will have a medium level of impact on the quality/strength of our product.Medium Level of EffortImprovement of the software architecture and operational architecture