You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Elastic integration packages load assets like mappings to ensure the data is indexed in the best way and dashboards / visualisations and other assets to consume the data. Currently there is no testing in place that validates if all the fields indexed are needed and are indexed in the best way. The following is a potential proposal on how some additional validation can be added.
Side note: More details around the topic can be found in the presentation from @3kt (Slides, Recording).
Compare what is mapped and ingested vs used
Each dataset maps the field that are used in the fields.yml files. With the introduction of the dynamic ecs@mappings template in Elasticsearch, now only the fields which are not ECS have to be mapped. Lets quickly introduce the relevant APIs based on the metrics-system.cpu-default data stream.
Mappings: To find out, what fields are mapped in an index, GET metrics-system.cpu-default/_mappingAPI can be used.
Disk usage per field: After ingestion, to find out which field uses how much storage, used the analyze index disk usage API: POST metrics-system.cpu-default/_disk_usage?run_expensive_tasks=true
Query usage: As soon as some query / visualisations are run, to get details on which fields are queried how, use the field usage stats API: GET metrics-system.cpu-default/_field_usage_stats
Disk usage total: For completeness, there is also the stats API that gives overall disk usage: GET metrics-system.cpu-default/_stats
With the first 3 APIs, we can have for a single field what is mapped, what is stored and what is queried.
Example
As our example, we use the metrics-system.memory-default data stream and the field system.memory.actual.used.pct. This is used in the System Metrics Overview dashboard:
Fist we want to see how the field is mapped an we run GET metrics-system.memory-default/_mapping. The result is as following:
As we see in the above, all the storage is used by doc_values which is expected as the field is set as a tiem_series_metrics. No inverted_index exists.
Last, we check if the field is also queried as expected:
GET metrics-system.memory-default/_field_usage_stats
The result is good news, only queries are run on doc_values and queries are run.
Next steps
If we look at other fields in metrics-system.memory-default, we can find fields which are mapped and ingested, but not used in the queries / visualisation. The basic idea I have is that could be done for an integration when running a test:
Elastic integration packages load assets like mappings to ensure the data is indexed in the best way and dashboards / visualisations and other assets to consume the data. Currently there is no testing in place that validates if all the fields indexed are needed and are indexed in the best way. The following is a potential proposal on how some additional validation can be added.
Side note: More details around the topic can be found in the presentation from @3kt (Slides, Recording).
Compare what is mapped and ingested vs used
Each dataset maps the field that are used in the fields.yml files. With the introduction of the dynamic
ecs@mappings
template in Elasticsearch, now only the fields which are not ECS have to be mapped. Lets quickly introduce the relevant APIs based on themetrics-system.cpu-default
data stream.GET metrics-system.cpu-default/_mapping
API can be used.POST metrics-system.cpu-default/_disk_usage?run_expensive_tasks=true
GET metrics-system.cpu-default/_field_usage_stats
GET metrics-system.cpu-default/_stats
With the first 3 APIs, we can have for a single field what is mapped, what is stored and what is queried.
Example
As our example, we use the
metrics-system.memory-default
data stream and the fieldsystem.memory.actual.used.pct
. This is used in the System Metrics Overview dashboard:Fist we want to see how the field is mapped an we run
GET metrics-system.memory-default/_mapping
. The result is as following:The field is mapped as
scaled_float
and"time_series_metric": "gauge"
. Now lets have a look at the disk usage.The following info is returned:
As we see in the above, all the storage is used by
doc_values
which is expected as the field is set as a tiem_series_metrics. No inverted_index exists.Last, we check if the field is also queried as expected:
The result is good news, only queries are run on
doc_values
and queries are run.Next steps
If we look at other fields in
metrics-system.memory-default
, we can find fields which are mapped and ingested, but not used in the queries / visualisation. The basic idea I have is that could be done for an integration when running a test:Links
The text was updated successfully, but these errors were encountered: