[CM] Onboard maps to cross-type search (#155148)

## Summary

Part of https://github.com/elastic/kibana/issues/152224
Follow up to https://github.com/elastic/kibana/issues/153256

This PR onboards maps CM integration into the multi-type search
(`msearch`). It isn't actually used anywhere in the user-facing UI yet,
as first other types need to be migrated to CM.

This PR also adds an example app to test the `msearch` end-to-end.
This commit is contained in:
Anton Dosov 2023-04-21 16:41:08 +02:00 committed by GitHub
parent cfc01d5444
commit 6aa1491c9e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 316 additions and 23 deletions

View file

@ -103,6 +103,20 @@ const searchSchemas = getOptionalInOutSchemas({
),
});
// Schema to validate the "msearch" service objects
const mSearchSchemas = schema.maybe(
schema.object({
out: schema.maybe(
schema.object(
{
result: schema.maybe(versionableObjectSchema),
},
{ unknowns: 'forbid' }
)
),
})
);
export const serviceDefinitionSchema = schema.object(
{
get: getSchemas,
@ -111,6 +125,7 @@ export const serviceDefinitionSchema = schema.object(
update: createSchemas,
delete: getSchemas,
search: searchSchemas,
mSearch: mSearchSchemas,
},
{ unknowns: 'forbid' }
);

View file

@ -240,6 +240,7 @@ describe('CM services getTransforms()', () => {
'delete.out.result',
'search.in.options',
'search.out.result',
'mSearch.out.result',
].sort()
);
});

View file

@ -34,6 +34,7 @@ const serviceObjectPaths = [
'delete.out.result',
'search.in.options',
'search.out.result',
'mSearch.out.result',
];
const validateServiceDefinitions = (definitions: ServiceDefinitionVersioned) => {
@ -175,6 +176,11 @@ const getDefaultServiceTransforms = (): ServiceTransforms => ({
result: getDefaultTransforms(),
},
},
mSearch: {
out: {
result: getDefaultTransforms(),
},
},
});
export const getTransforms = (

View file

@ -59,6 +59,11 @@ export interface ServicesDefinition {
result?: VersionableObject<any, any, any, any>;
};
};
mSearch?: {
out?: {
result?: VersionableObject<any, any, any, any>;
};
};
}
export interface ServiceTransforms {
@ -112,6 +117,11 @@ export interface ServiceTransforms {
result: ObjectTransforms<any, any, any, any>;
};
};
mSearch: {
out: {
result: ObjectTransforms<any, any, any, any>;
};
};
}
export interface ServiceDefinitionVersioned {