Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/testrunner/runners/system/tester.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const FieldsQuery = `{
"my_ignored": {
"type": "keyword",
"script": {
"source": "for (def v : params['_fields']._ignored.values) { emit(v); }"
"source": "for (def v : doc['_ignored']) { emit(v); }"
}
}
},
Expand Down
15 changes: 15 additions & 0 deletions internal/testrunner/runners/system/tester_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package system

import (
"encoding/json"
"fmt"
"maps"
"os"
Expand All @@ -26,6 +27,20 @@ import (
"github.com/elastic/elastic-package/internal/testrunner"
)

func TestFieldsQueryReadsIgnoredFromDocValues(t *testing.T) {
var query struct {
RuntimeMappings map[string]struct {
Script struct {
Source string `json:"source"`
} `json:"script"`
} `json:"runtime_mappings"`
}

require.NoError(t, json.Unmarshal([]byte(FieldsQuery), &query))
assert.Equal(t, "for (def v : doc['_ignored']) { emit(v); }", query.RuntimeMappings["my_ignored"].Script.Source)
assert.NotContains(t, FieldsQuery, "params['_fields']")
}

func TestFindPolicyTemplateForInput(t *testing.T) {
const policyTemplateName = "my_policy_template"
const dataStreamName = "my_data_stream"
Expand Down