Skip to content

Commit 6a56939

Browse files
klacabanekibanamachinetommyers-elastic
authored
[streams][content pack] archive format and portable dashboards (elastic#217288)
## Summary Allows one to export and import content packs in archive format. The format follows the integration content package's format so it becomes possible to import existing integration packages. Content packs only support dashboard assets at the moment. A pattern replacement logic has been implemented for dashboards and referenced data views: - at export time, any pattern matching the source stream will be replaced with a placeholder. Other patterns will remain as-is unless user explicitly ask to replace them - at import time, the placeholders are replaced with the target stream pattern For example, if a dashboard is first exported from stream `logs.nodejs` and reads data from patterns `logs.nodejs` and `logs.nodejs.prod`, the patterns will be updated to `logs.ruby` and `logs.ruby.prod` when imported into `logs.ruby` stream. The relevant UI components are hidden behind a feature flag, set the following in `kibana.dev.yml` to enable them: `feature_flags.overrides.featureFlagsStreams.contentPackUIEnabled: true` https://github.com/user-attachments/assets/9fb07daf-9fb9-4c62-9f5b-387e1833eaf0 --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: tommyers-elastic <106530686+tommyers-elastic@users.noreply.github.com>
1 parent b936b47 commit 6a56939

40 files changed

Lines changed: 2044 additions & 158 deletions

File tree

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -820,6 +820,7 @@ x-pack/platform/packages/shared/kbn-ai-assistant @elastic/search-kibana @elastic
820820
x-pack/platform/packages/shared/kbn-alerting-comparators @elastic/response-ops
821821
x-pack/platform/packages/shared/kbn-apm-types @elastic/obs-ux-infra_services-team
822822
x-pack/platform/packages/shared/kbn-cloud-security-posture/common @elastic/kibana-cloud-security-posture
823+
x-pack/platform/packages/shared/kbn-content-packs-schema @elastic/streams-program-team
823824
x-pack/platform/packages/shared/kbn-data-forge @elastic/obs-ux-management-team
824825
x-pack/platform/packages/shared/kbn-elastic-assistant @elastic/security-generative-ai
825826
x-pack/platform/packages/shared/kbn-elastic-assistant-common @elastic/security-generative-ai

oas_docs/bundle.json

Lines changed: 70 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -53795,22 +53795,74 @@
5379553795
"content": {
5379653796
"application/json": {
5379753797
"schema": {
53798-
"anyOf": [
53799-
{
53800-
"additionalProperties": false,
53801-
"properties": {},
53802-
"type": "object"
53798+
"additionalProperties": false,
53799+
"properties": {
53800+
"description": {
53801+
"type": "string"
5380353802
},
53804-
{
53805-
"enum": [
53806-
"null"
53807-
],
53808-
"nullable": true
53803+
"include": {
53804+
"anyOf": [
53805+
{
53806+
"additionalProperties": false,
53807+
"properties": {
53808+
"objects": {
53809+
"additionalProperties": false,
53810+
"properties": {
53811+
"dashboards": {
53812+
"items": {
53813+
"type": "string"
53814+
},
53815+
"type": "array"
53816+
}
53817+
},
53818+
"required": [
53819+
"dashboards"
53820+
],
53821+
"type": "object"
53822+
}
53823+
},
53824+
"required": [
53825+
"objects"
53826+
],
53827+
"type": "object"
53828+
},
53829+
{
53830+
"additionalProperties": false,
53831+
"properties": {
53832+
"all": {
53833+
"additionalProperties": false,
53834+
"properties": {},
53835+
"type": "object"
53836+
}
53837+
},
53838+
"required": [
53839+
"all"
53840+
],
53841+
"type": "object"
53842+
}
53843+
]
5380953844
},
53810-
{
53811-
"not": {}
53845+
"name": {
53846+
"type": "string"
53847+
},
53848+
"replaced_patterns": {
53849+
"items": {
53850+
"type": "string"
53851+
},
53852+
"type": "array"
53853+
},
53854+
"version": {
53855+
"type": "string"
5381253856
}
53813-
]
53857+
},
53858+
"required": [
53859+
"name",
53860+
"description",
53861+
"version",
53862+
"replaced_patterns",
53863+
"include"
53864+
],
53865+
"type": "object"
5381453866
}
5381553867
}
5381653868
}
@@ -53852,9 +53904,13 @@
5385253904
"schema": {
5385353905
"additionalProperties": false,
5385453906
"properties": {
53855-
"content": {}
53907+
"content": {},
53908+
"include": {
53909+
"type": "string"
53910+
}
5385653911
},
5385753912
"required": [
53913+
"include",
5385853914
"content"
5385953915
],
5386053916
"type": "object"

oas_docs/bundle.serverless.json

Lines changed: 70 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -53386,22 +53386,74 @@
5338653386
"content": {
5338753387
"application/json": {
5338853388
"schema": {
53389-
"anyOf": [
53390-
{
53391-
"additionalProperties": false,
53392-
"properties": {},
53393-
"type": "object"
53389+
"additionalProperties": false,
53390+
"properties": {
53391+
"description": {
53392+
"type": "string"
5339453393
},
53395-
{
53396-
"enum": [
53397-
"null"
53398-
],
53399-
"nullable": true
53394+
"include": {
53395+
"anyOf": [
53396+
{
53397+
"additionalProperties": false,
53398+
"properties": {
53399+
"objects": {
53400+
"additionalProperties": false,
53401+
"properties": {
53402+
"dashboards": {
53403+
"items": {
53404+
"type": "string"
53405+
},
53406+
"type": "array"
53407+
}
53408+
},
53409+
"required": [
53410+
"dashboards"
53411+
],
53412+
"type": "object"
53413+
}
53414+
},
53415+
"required": [
53416+
"objects"
53417+
],
53418+
"type": "object"
53419+
},
53420+
{
53421+
"additionalProperties": false,
53422+
"properties": {
53423+
"all": {
53424+
"additionalProperties": false,
53425+
"properties": {},
53426+
"type": "object"
53427+
}
53428+
},
53429+
"required": [
53430+
"all"
53431+
],
53432+
"type": "object"
53433+
}
53434+
]
5340053435
},
53401-
{
53402-
"not": {}
53436+
"name": {
53437+
"type": "string"
53438+
},
53439+
"replaced_patterns": {
53440+
"items": {
53441+
"type": "string"
53442+
},
53443+
"type": "array"
53444+
},
53445+
"version": {
53446+
"type": "string"
5340353447
}
53404-
]
53448+
},
53449+
"required": [
53450+
"name",
53451+
"description",
53452+
"version",
53453+
"replaced_patterns",
53454+
"include"
53455+
],
53456+
"type": "object"
5340553457
}
5340653458
}
5340753459
}
@@ -53443,9 +53495,13 @@
5344353495
"schema": {
5344453496
"additionalProperties": false,
5344553497
"properties": {
53446-
"content": {}
53498+
"content": {},
53499+
"include": {
53500+
"type": "string"
53501+
}
5344753502
},
5344853503
"required": [
53504+
"include",
5344953505
"content"
5345053506
],
5345153507
"type": "object"

oas_docs/output/kibana.serverless.yaml

Lines changed: 48 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48355,14 +48355,51 @@ paths:
4835548355
content:
4835648356
application/json:
4835748357
schema:
48358-
anyOf:
48359-
- additionalProperties: false
48360-
type: object
48361-
properties: {}
48362-
- enum:
48363-
- 'null'
48364-
nullable: true
48365-
- not: {}
48358+
additionalProperties: false
48359+
type: object
48360+
properties:
48361+
description:
48362+
type: string
48363+
include:
48364+
anyOf:
48365+
- additionalProperties: false
48366+
type: object
48367+
properties:
48368+
objects:
48369+
additionalProperties: false
48370+
type: object
48371+
properties:
48372+
dashboards:
48373+
items:
48374+
type: string
48375+
type: array
48376+
required:
48377+
- dashboards
48378+
required:
48379+
- objects
48380+
- additionalProperties: false
48381+
type: object
48382+
properties:
48383+
all:
48384+
additionalProperties: false
48385+
type: object
48386+
properties: {}
48387+
required:
48388+
- all
48389+
name:
48390+
type: string
48391+
replaced_patterns:
48392+
items:
48393+
type: string
48394+
type: array
48395+
version:
48396+
type: string
48397+
required:
48398+
- name
48399+
- description
48400+
- version
48401+
- replaced_patterns
48402+
- include
4836648403
responses: {}
4836748404
summary: Export stream content
4836848405
tags:
@@ -48392,7 +48429,10 @@ paths:
4839248429
type: object
4839348430
properties:
4839448431
content: {}
48432+
include:
48433+
type: string
4839548434
required:
48435+
- include
4839648436
- content
4839748437
responses: {}
4839848438
summary: Import content into a stream

oas_docs/output/kibana.yaml

Lines changed: 48 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51877,14 +51877,51 @@ paths:
5187751877
content:
5187851878
application/json:
5187951879
schema:
51880-
anyOf:
51881-
- additionalProperties: false
51882-
type: object
51883-
properties: {}
51884-
- enum:
51885-
- 'null'
51886-
nullable: true
51887-
- not: {}
51880+
additionalProperties: false
51881+
type: object
51882+
properties:
51883+
description:
51884+
type: string
51885+
include:
51886+
anyOf:
51887+
- additionalProperties: false
51888+
type: object
51889+
properties:
51890+
objects:
51891+
additionalProperties: false
51892+
type: object
51893+
properties:
51894+
dashboards:
51895+
items:
51896+
type: string
51897+
type: array
51898+
required:
51899+
- dashboards
51900+
required:
51901+
- objects
51902+
- additionalProperties: false
51903+
type: object
51904+
properties:
51905+
all:
51906+
additionalProperties: false
51907+
type: object
51908+
properties: {}
51909+
required:
51910+
- all
51911+
name:
51912+
type: string
51913+
replaced_patterns:
51914+
items:
51915+
type: string
51916+
type: array
51917+
version:
51918+
type: string
51919+
required:
51920+
- name
51921+
- description
51922+
- version
51923+
- replaced_patterns
51924+
- include
5188851925
responses: {}
5188951926
summary: Export stream content
5189051927
tags:
@@ -51914,7 +51951,10 @@ paths:
5191451951
type: object
5191551952
properties:
5191651953
content: {}
51954+
include:
51955+
type: string
5191751956
required:
51957+
- include
5191851958
- content
5191951959
responses: {}
5192051960
summary: Import content into a stream

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@
253253
"@kbn/content-management-table-list-view-table": "link:src/platform/packages/shared/content-management/table_list_view_table",
254254
"@kbn/content-management-user-profiles": "link:src/platform/packages/shared/content-management/user_profiles",
255255
"@kbn/content-management-utils": "link:src/platform/packages/shared/kbn-content-management-utils",
256+
"@kbn/content-packs-schema": "link:x-pack/platform/packages/shared/kbn-content-packs-schema",
256257
"@kbn/controls-example-plugin": "link:examples/controls_example",
257258
"@kbn/controls-plugin": "link:src/platform/plugins/shared/controls",
258259
"@kbn/core": "link:src/core",

src/platform/packages/shared/kbn-esql-utils/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ export {
4040
getValuesFromQueryField,
4141
getESQLQueryVariables,
4242
fixESQLQueryWithVariables,
43+
replaceESQLQueryIndexPattern,
4344
} from './src';
4445

4546
export { ENABLE_ESQL, FEEDBACK_LINK } from './constants';

src/platform/packages/shared/kbn-esql-utils/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,4 @@ export {
4646
isESQLFieldGroupable,
4747
} from './utils/esql_fields_utils';
4848
export { sanitazeESQLInput } from './utils/sanitaze_input';
49+
export { replaceESQLQueryIndexPattern } from './utils/replace_index_pattern';

0 commit comments

Comments
 (0)