Skip to content

Add support for saved search assets in content packages - #1210

Merged
mrodm merged 5 commits into
elastic:mainfrom
tommyers-elastic:add-saved-search-content-packages
Jul 30, 2026
Merged

Add support for saved search assets in content packages#1210
mrodm merged 5 commits into
elastic:mainfrom
tommyers-elastic:add-saved-search-content-packages

Conversation

@tommyers-elastic

@tommyers-elastic tommyers-elastic commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds support for Kibana saved search assets (kibana/search) in content packages, mirroring the existing definition for integration packages (same filename pattern and forbidden -ecs/-ECS suffix rule).

The asset is allowed at all content spec versions (no versions: guard), following the precedent of security_rule (#885) and ml_module (#1149), and the deliberate relaxation of the slo_template/alerting_rule_template guards in #1064: since the stack already supports installing these assets, existing content packages can adopt them without a format_version bump.

Also adds a saved search asset to the good_content test package (which stays at format_version: 3.6.0, exercising the folder at an older spec version).

Why is it important?

Content packages currently cannot ship saved searches, even though integration packages can and Kibana/Fleet is already capable of installing them for content packages.

We are planning to use Integration-managed saved searches to power "inventory views" in Kibana.

Checklist

  • I have added an entry to spec/changelog.yml.

🤖 Generated with Claude Code

Saved search assets (kibana/search) are already supported in integration
packages. Allow them in content packages too, guarded to spec versions
>= 3.7.0. Fleet installs Kibana assets for content packages through the
same streaming install path as integration packages, with no per-package-type
asset filtering, so these assets are installed as-is once present.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@tommyers-elastic
tommyers-elastic requested a review from a team as a code owner July 21, 2026 15:50
tommyers-elastic and others added 2 commits July 21, 2026 16:53
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Follow the security_rule (elastic#885) and ml_module (elastic#1149) precedent: allow
the asset at all content spec versions, since Fleet already installs it.
good_content stays at format_version 3.6.0, which also exercises the
folder at an older spec version.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Comment thread spec/changelog.yml
type: file
contentMediaType: "application/json"
pattern: '^{PACKAGE_NAME}-.+\.json$'
- description: Folder containing Kibana saved search assets

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how are these assets included on the package? is there an import command within elastic-package we need to update related to this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the saved searches look like this, i don't think we need any scaffolding to generate these.

{
    "id": "saved_search_demo-search-logs",
    "type": "search",
    "typeMigrationVersion": "8.0.0",
    "attributes": {
        "title": "Demo logs ES|QL search",
        "description": "Simple ES|QL saved search over logs-*",
        "columns": [],
        "sort": [],
        "isTextBasedQuery": true,
        "timeRestore": false,
        "kibanaSavedObjectMeta": {
            "searchSourceJSON": "{\"query\":{\"esql\":\"FROM logs-*\"},\"filter\":[]}"
        }
    }
}

@teresaromero teresaromero left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

waiting to approve for the changelog entry change

@infra-vault-gh-plugin-prod

Copy link
Copy Markdown

💚 Build Succeeded

History

@mergify

mergify Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@mrodm
mrodm merged commit 1d781fc into elastic:main Jul 30, 2026
4 checks passed
andrewkroh pushed a commit to andrewkroh/go-package-spec that referenced this pull request Aug 4, 2026
Regenerate the data model from andrewkroh/package-spec-schema at commit
e59fb7f, and propagate the new schema surface through to the SQL tables.

Schema changes in 3.6.6:

- Add top-level `group` field to integration, input, and content package
  manifests for declaring marketplace group membership (elastic/package-spec#1213).
- Allow policy tests to ignore fields (elastic/package-spec#1214).
- Add support for saved search assets in content packages (elastic/package-spec#1210).
- Remove the search type from by-reference validation checks
  (elastic/package-spec#1196), plus mode-aware constructors and `source`/`build`
  validation modes (elastic/package-spec#1177, elastic/package-spec#1178). These
  are package-spec tooling and validation changes with no schema surface, so
  they have no effect here.

The `group` field is declared on all three manifest types, so list it under
the `Manifest` base type in cmd/generate/augment.yml rather than emitting
three copies. This is what makes it reachable from SQL: the `packages` table
is generated by reflecting over `Manifest`, so a field on a concrete manifest
type would be invisible to cmd/gensql. Regeneration then adds a `packages.group`
column, quoted because `group` is a SQLite keyword. Absent values store as
NULL rather than the empty string.

Saved searches in content packages need no code change. readKibanaObjects
discovers asset types by scanning subdirectories of kibana/, so
kibana/search/*.json already reached the kibana_saved_objects table. Add a
test to pin the behavior and document the asset type in CLAUDE.md.

Policy test `ignore_fields` needs no SQL change. The policy_tests table is
built from PolicyTestConfig, which models the per-case
_dev/test/policy/test-*.yml files. The new PolicyConfigTests type belongs to
the package-level _dev/test/config.yml, which pkgreader does not read and
which is therefore not persisted.

BREAKING CHANGE: TestConfig.Policy and InputTestConfig.Policy change type
from TestCategoryConfig to the new PolicyConfigTests, which adds
`ignore_fields` alongside the existing `parallel`, `skip`, and `requires`
keys. Callers reading either field must be updated.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants