Skip to content

Commit b358e97

Browse files
authored
Add support for specifying a constant_keyword value (#194)
For the `constant_keyword` field type Elasticsearch allows for the value to be specified in the mapping. If the value is not specified in the mapping then the value is set based on the first document that is indexed. Package data streams will be able to explicitly declare a constant_keyword value and will not have to include the field with every document sent. https://www.elastic.co/guide/en/elasticsearch//reference/7.12/keyword.html#constant-keyword-params
1 parent 342d612 commit b358e97

5 files changed

Lines changed: 12 additions & 3 deletions

File tree

code/go/internal/spec/statik.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/packages/good/data_stream/foo/fields/external-fields.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
description: Event family
44
fields:
55
- name: category
6-
external: ecs
6+
external: ecs

test/packages/good/data_stream/foo/fields/some_fields.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,6 @@
3232
- name: dynamic_histogram
3333
type: histogram
3434
dynamic_template: true
35+
- name: vehicle_type
36+
type: constant_keyword
37+
value: truck

versions/1/changelog.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,4 +144,7 @@
144144
link: https://github.com/elastic/package-spec/pull/191
145145
- description: Improve semantic versioning for version integrity
146146
type: enhancement
147-
link: https://github.com/elastic/package-spec/pull/193
147+
link: https://github.com/elastic/package-spec/pull/193
148+
- description: Introduce "value" property for constant_keyword fields
149+
type: enhancement
150+
link: https://github.com/elastic/package-spec/pull/194

versions/1/data_stream/fields/fields.spec.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ spec:
5454
description:
5555
description: Short description of field
5656
type: string
57+
value:
58+
description: The value to associate with a constant_keyword field.
59+
type: string
5760
metric_type:
5861
description: Metric type
5962
type: string

0 commit comments

Comments
 (0)