mirror of
https://github.com/elastic/kibana.git
synced 2025-06-27 18:51:07 -04:00
[Discover][Saved Query] Add schema for Saved Query SO (#154230)
## Summary A follow up for https://github.com/elastic/kibana/pull/153131 This PR adds schema for Saved Query SO type.
This commit is contained in:
parent
970de9147e
commit
682f12ea77
3 changed files with 38 additions and 12 deletions
|
@ -123,7 +123,7 @@ describe('checking migration metadata changes on all registered SO types', () =>
|
|||
"osquery-pack": "edd84b2c59ef36214ece0676706da8f22175c660",
|
||||
"osquery-pack-asset": "18e08979d46ee7e5538f54c080aec4d8c58516ca",
|
||||
"osquery-saved-query": "f5e4e303f65c7607248ea8b2672f1ee30e4fb15e",
|
||||
"query": "ec6000b775f06f81470df42d23f7a88cb31d64ba",
|
||||
"query": "cfc049e1f0574fb4fdb2d653d7c10bdc970a2610",
|
||||
"rules-settings": "9854495c3b54b16a6625fb250c35e5504da72266",
|
||||
"sample-data-telemetry": "c38daf1a49ed24f2a4fb091e6e1e833fccf19935",
|
||||
"search": "ed3a9b1681b57d69560909d51933fdf17576ea68",
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
import { SavedObjectsType } from '@kbn/core/server';
|
||||
import { savedQueryMigrations } from './migrations/query';
|
||||
import { SCHEMA_QUERY_V8_8_0 } from './schemas/query';
|
||||
|
||||
export const querySavedObjectType: SavedObjectsType = {
|
||||
name: 'query',
|
||||
|
@ -29,21 +30,14 @@ export const querySavedObjectType: SavedObjectsType = {
|
|||
},
|
||||
},
|
||||
mappings: {
|
||||
dynamic: false,
|
||||
properties: {
|
||||
title: { type: 'text' },
|
||||
description: { type: 'text' },
|
||||
query: {
|
||||
dynamic: false,
|
||||
properties: {
|
||||
language: { type: 'keyword' },
|
||||
},
|
||||
},
|
||||
filters: {
|
||||
dynamic: false,
|
||||
properties: {},
|
||||
},
|
||||
timefilter: { dynamic: false, properties: {} },
|
||||
},
|
||||
},
|
||||
migrations: savedQueryMigrations,
|
||||
schemas: {
|
||||
'8.8.0': SCHEMA_QUERY_V8_8_0,
|
||||
},
|
||||
};
|
||||
|
|
32
src/plugins/data/server/saved_objects/schemas/query.ts
Normal file
32
src/plugins/data/server/saved_objects/schemas/query.ts
Normal file
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
||||
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
||||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import { schema } from '@kbn/config-schema';
|
||||
|
||||
// As per `SavedQueryAttributes`
|
||||
export const SCHEMA_QUERY_V8_8_0 = schema.object({
|
||||
title: schema.string(),
|
||||
description: schema.string({ defaultValue: '' }),
|
||||
query: schema.object({
|
||||
language: schema.string(),
|
||||
query: schema.oneOf([schema.string(), schema.object({}, { unknowns: 'allow' })]),
|
||||
}),
|
||||
filters: schema.maybe(schema.arrayOf(schema.object({}, { unknowns: 'allow' }))),
|
||||
timefilter: schema.maybe(
|
||||
schema.object({
|
||||
from: schema.string(),
|
||||
to: schema.string(),
|
||||
refreshInterval: schema.maybe(
|
||||
schema.object({
|
||||
value: schema.number(),
|
||||
pause: schema.boolean(),
|
||||
})
|
||||
),
|
||||
})
|
||||
),
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue