-
Notifications
You must be signed in to change notification settings - Fork 25.9k
Introduce experimental pass-through field type #103648
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
3cb55c6
c78ac7d
5d75fee
c963956
2a09fbb
95934b0
81352d1
7360729
c174890
38494bb
9fa98ae
0700310
5e1a996
db6afcb
6fd96ae
1bf0c87
8204dc5
997864a
5c125ad
698e281
7598e9b
0e698bd
e5f58fe
5bb6f20
95e2260
25eb507
45bb20c
8a8f3ff
2b78a0c
5ade2db
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| pr: 103648 | ||
| summary: Introduce experimental pass-through field type | ||
| area: TSDB | ||
| type: enhancement | ||
| issues: [] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -191,3 +191,262 @@ index without timestamp with pipeline: | |
| pipeline: my_pipeline | ||
| body: | ||
| - '{"@timestamp": "wrong_format", "metricset": "pod", "k8s": {"pod": {"name": "cat", "uid":"947e4ced-1786-4e53-9e0c-5c447e959507", "ip": "10.10.55.1", "network": {"tx": 2001818691, "rx": 802133794}}}}' | ||
|
|
||
| --- | ||
| dynamic templates: | ||
| - skip: | ||
| version: " - 8.12.99" | ||
| reason: "Support for dynamic fields was added in 8.13" | ||
| - do: | ||
| indices.put_index_template: | ||
| name: my-dynamic-template | ||
| body: | ||
| index_patterns: [k9s*] | ||
| data_stream: {} | ||
| template: | ||
| settings: | ||
| index: | ||
| number_of_shards: 1 | ||
| mode: time_series | ||
| time_series: | ||
| start_time: 2023-08-31T13:03:08.138Z | ||
|
|
||
| mappings: | ||
| properties: | ||
| attributes: | ||
| type: passthrough | ||
| dynamic: true | ||
| time_series_dimension: true | ||
| dynamic_templates: | ||
| - counter_metric: | ||
| mapping: | ||
| type: integer | ||
| time_series_metric: counter | ||
|
|
||
| - do: | ||
| bulk: | ||
| index: k9s | ||
|
felixbarny marked this conversation as resolved.
|
||
| refresh: true | ||
| body: | ||
| - '{ "create": { "dynamic_templates": { "data": "counter_metric" } } }' | ||
| - '{ "@timestamp": "2023-09-01T13:03:08.138Z","data": "10", "attributes.dim": "A", "attributes.another.dim": "C" }' | ||
| - '{ "create": { "dynamic_templates": { "data": "counter_metric" } } }' | ||
| - '{ "@timestamp": "2023-09-01T13:03:09.138Z","data": "20", "attributes.dim": "A", "attributes.another.dim": "C" }' | ||
| - '{ "create": { "dynamic_templates": { "data": "counter_metric" } } }' | ||
| - '{ "@timestamp": "2023-09-01T13:03:10.138Z","data": "30", "attributes.dim": "B", "attributes.another.dim": "D" }' | ||
| - '{ "create": { "dynamic_templates": { "data": "counter_metric" } } }' | ||
| - '{ "@timestamp": "2023-09-01T13:03:10.238Z","data": "40", "attributes.dim": "B", "attributes.another.dim": "D" }' | ||
|
|
||
| - do: | ||
| search: | ||
| index: k9s | ||
| body: | ||
| size: 0 | ||
|
|
||
| - match: { hits.total.value: 4 } | ||
|
|
||
| - do: | ||
| search: | ||
| index: k9s | ||
| body: | ||
| size: 0 | ||
| aggs: | ||
| filterA: | ||
| filter: | ||
| term: | ||
| dim: A | ||
| aggs: | ||
| tsids: | ||
| terms: | ||
| field: _tsid | ||
|
|
||
| - length: { aggregations.filterA.tsids.buckets: 1 } | ||
| - match: { aggregations.filterA.tsids.buckets.0.key: { "attributes.another.dim": "C", "attributes.dim": "A" } } | ||
| - match: { aggregations.filterA.tsids.buckets.0.doc_count: 2 } | ||
|
|
||
| - do: | ||
| search: | ||
| index: k9s | ||
| body: | ||
| size: 0 | ||
| aggs: | ||
| filterA: | ||
| filter: | ||
| term: | ||
| another.dim: C | ||
| aggs: | ||
| tsids: | ||
| terms: | ||
| field: _tsid | ||
|
|
||
| - length: { aggregations.filterA.tsids.buckets: 1 } | ||
| - match: { aggregations.filterA.tsids.buckets.0.key: { "attributes.another.dim": "C", "attributes.dim": "A" } } | ||
| - match: { aggregations.filterA.tsids.buckets.0.doc_count: 2 } | ||
|
|
||
| --- | ||
| dynamic templates - conflicting aliases: | ||
| - skip: | ||
| version: " - 8.12.99" | ||
| reason: "Support for dynamic fields was added in 8.13" | ||
| - do: | ||
| indices.put_index_template: | ||
| name: my-dynamic-template | ||
| body: | ||
| index_patterns: [k9s*] | ||
| data_stream: {} | ||
| template: | ||
| settings: | ||
| index: | ||
| number_of_shards: 1 | ||
| mode: time_series | ||
| time_series: | ||
| start_time: 2023-08-31T13:03:08.138Z | ||
|
|
||
| mappings: | ||
| properties: | ||
| attributes: | ||
| type: passthrough | ||
| dynamic: true | ||
| time_series_dimension: true | ||
| resource_attributes: | ||
| type: passthrough | ||
| dynamic: true | ||
| time_series_dimension: true | ||
| dynamic_templates: | ||
| - counter_metric: | ||
| mapping: | ||
| type: integer | ||
| time_series_metric: counter | ||
|
|
||
| - do: | ||
| bulk: | ||
| index: k9s | ||
| refresh: true | ||
| body: | ||
| - '{ "create": { "dynamic_templates": { "data": "counter_metric" } } }' | ||
| - '{ "@timestamp": "2023-09-01T13:03:08.138Z","data": "10", "attributes.dim": "A", "resource_attributes.dim": "C" }' | ||
| - '{ "create": { "dynamic_templates": { "data": "counter_metric" } } }' | ||
| - '{ "@timestamp": "2023-09-01T13:03:09.138Z","data": "20", "attributes.dim": "A", "resource_attributes.dim": "C" }' | ||
| - '{ "create": { "dynamic_templates": { "data": "counter_metric" } } }' | ||
| - '{ "@timestamp": "2023-09-01T13:03:10.138Z","data": "30", "attributes.dim": "B", "resource_attributes.dim": "D" }' | ||
| - '{ "create": { "dynamic_templates": { "data": "counter_metric" } } }' | ||
| - '{ "@timestamp": "2023-09-01T13:03:10.238Z","data": "40", "attributes.dim": "B", "resource_attributes.dim": "D" }' | ||
|
|
||
| - do: | ||
| search: | ||
| index: k9s | ||
| body: | ||
| size: 0 | ||
|
|
||
| - match: { hits.total.value: 4 } | ||
|
|
||
| - do: | ||
| search: | ||
| index: k9s | ||
| body: | ||
| size: 0 | ||
| aggs: | ||
| filterA: | ||
| filter: | ||
| term: | ||
| dim: "C" | ||
| aggs: | ||
| tsids: | ||
| terms: | ||
| field: _tsid | ||
|
|
||
| - length: { aggregations.filterA.tsids.buckets: 1 } | ||
| - match: { aggregations.filterA.tsids.buckets.0.key: { "resource_attributes.dim": "C", "attributes.dim": "A" } } | ||
| - match: { aggregations.filterA.tsids.buckets.0.doc_count: 2 } | ||
|
|
||
| - do: | ||
| search: | ||
| index: k9s | ||
| body: | ||
| size: 0 | ||
| aggs: | ||
| filterA: | ||
| filter: | ||
| term: | ||
| attributes.dim: A | ||
| aggs: | ||
| tsids: | ||
| terms: | ||
| field: _tsid | ||
|
|
||
| - length: { aggregations.filterA.tsids.buckets: 1 } | ||
| - match: { aggregations.filterA.tsids.buckets.0.key: { "resource_attributes.dim": "C", "attributes.dim": "A" } } | ||
| - match: { aggregations.filterA.tsids.buckets.0.doc_count: 2 } | ||
|
|
||
| --- | ||
| dynamic templates - subobject in passthrough object error: | ||
| - skip: | ||
| version: " - 8.12.99" | ||
| reason: "Support for dynamic fields was added in 8.13" | ||
| - do: | ||
| catch: /Tried to add subobject \[subcategory\] to object \[attributes\] which does not support subobjects/ | ||
| indices.put_index_template: | ||
| name: my-dynamic-template | ||
| body: | ||
| index_patterns: [k9s*] | ||
| data_stream: {} | ||
| template: | ||
| settings: | ||
| index: | ||
| mode: time_series | ||
|
|
||
| mappings: | ||
| properties: | ||
| attributes: | ||
| type: passthrough | ||
| properties: | ||
| subcategory: | ||
| type: object | ||
| properties: | ||
| dim: | ||
| type: keyword | ||
|
|
||
| - do: | ||
| catch: /Mapping definition for \[attributes\] has unsupported parameters:\ \[subobjects \:\ true\]/ | ||
| indices.put_index_template: | ||
| name: my-dynamic-template | ||
| body: | ||
| index_patterns: [k9s*] | ||
| data_stream: {} | ||
| template: | ||
| settings: | ||
| index: | ||
| number_of_shards: 1 | ||
| mode: time_series | ||
| time_series: | ||
| start_time: 2023-08-31T13:03:08.138Z | ||
|
|
||
| mappings: | ||
| properties: | ||
| attributes: | ||
| type: passthrough | ||
| subobjects: true | ||
|
|
||
| --- | ||
| dynamic templates - passthrough not under root error: | ||
| - skip: | ||
| version: " - 8.12.99" | ||
| reason: "Support for dynamic fields was added in 8.13" | ||
| - do: | ||
| catch: /Tried to add passthrough subobject \[attributes\] to object \[resource\], passthrough is not supported as a subobject/ | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why can't object types have a property of type passthrough? I think we were discussing the opposite where properties of the passthrough field type can't be other objects i.e.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It complicates how aliases are added to the root object. We can look into this in a follow-up change - unless Martijn knows of a simple way to navigate to the root object from the passthrough object builders.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Gotcha. Another alternative would be to recurse the object mappers.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Given how we'd want to use the passthrough field type, it would be great if it was supported not only at the root level. See also #104455.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah I'll prioritize supporting this and non-keyword dimension fields. |
||
| indices.put_index_template: | ||
| name: my-dynamic-template | ||
| body: | ||
| index_patterns: [k9s*] | ||
| data_stream: {} | ||
| template: | ||
| settings: | ||
| index: | ||
| mode: time_series | ||
|
|
||
| mappings: | ||
| properties: | ||
| "resource.attributes": | ||
| type: passthrough | ||
| dynamic: true | ||
| time_series_dimension: true | ||
Uh oh!
There was an error while loading. Please reload this page.