elastic / elastic/package-spec
[Change Proposal][Bug] Allow `boolean` as a TSDB dimension
- Dominant language
- Go
- Stars
- 20
- Forks
- 93
- Avg merge
- 15h 10m
- Merged PRs (30d)
- 12
Description
The current spec/validation rules for TSDB fields that are allowed to be dimensions are missing `boolean`. Currently it's a valid type to be a dimension, see docs. However when building a package setting boolean as TSDB dimensions an validation error is shown:
```
Error: package installation failed: failed to build package: invalid content found in built zip package: found 8 validation errors:
1. file "/home/user/devel/github.com/elastic/integrations/build/packages/linux-1.1.0.zip/data_stream/conntrack/fields/agent.yml" is invalid: field "host.containerized" of type boolean can't be a dimension, allowed types for dimensions: constant_keyword, keyword, long, integer, short, byte, double, float, half_float, scaled_float, unsigned_long, ip
```
It'd be good to update the spec and elastic-package to support `boolean` as it's now supported by Elasticsearch.
The list of supported types for dimension fields is validated in https://github.com/elastic/package-spec/blob/3e48996fb4c8a34ef105b0487fe689b8ab69000f/code/go/internal/validator/semantic/validate_dimensions.go#L36
The first version of Elasticsearch that documents boolean as supported type for dimension is 8.16 ([here](https://www.elastic.co/guide/en/elasticsearch/reference/8.16/tsds.html#time-series-dimension)), so it should be supported only on versions of the spec over 3.1, see https://github.com/elastic/elastic-package/blob/main/docs/howto/format_version.md#what-format-version-to-choose-for-a-package
Contributor guide
Research direction
Start with code/go/internal/validator/semantic/validate_dimensions.go, where the supported dimension types are validated, and review the format-version guidance in docs/howto/format_version.md. Done means boolean dimensions are accepted for spec versions over 3.1 while the version constraint remains enforced, and package validation no longer reports the shown error for supported versions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- build-system, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100