Skip to content

Conversation

@gmarouli
Copy link
Contributor

@gmarouli gmarouli commented Dec 2, 2025

Recently, we identified certain edge cases when downsampling multi-fields:

  • A time series metric should not be downsampled when it's a sub-field because it needs to be downsampled differently than the parent field.
  • When a field has multiple sub-fields, we only need to use one as the source to retrieve the value, it could be either the parent or one of the sub-fields. If one of the parent or one of the sub-fields is a dimension, we choose the dimension sub-field as a source. Otherwise, if the parent field is not aggregatable, we choose the first aggregatable sub-field we have seen.

@elasticsearchmachine elasticsearchmachine added v9.3.0 needs:triage Requires assignment of a team area label labels Dec 2, 2025
@gmarouli gmarouli added the :StorageEngine/Downsampling Downsampling (replacement for rollups) - Turn fine-grained time-based data into coarser-grained data label Dec 2, 2025
@elasticsearchmachine elasticsearchmachine added Team:StorageEngine and removed needs:triage Requires assignment of a team area label labels Dec 2, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-storage-engine (Team:StorageEngine)

@gmarouli gmarouli added >bug needs:triage Requires assignment of a team area label and removed Team:StorageEngine labels Dec 2, 2025
@elasticsearchmachine
Copy link
Collaborator

Hi @gmarouli, I've created a changelog YAML for you.

@elasticsearchmachine elasticsearchmachine removed the needs:triage Requires assignment of a team area label label Dec 2, 2025
@gmarouli gmarouli added auto-backport Automatically create backport pull requests when merged branch:9.2 branch:9.1 branch:8.19 labels Dec 3, 2025
@gmarouli gmarouli requested a review from martijnvg December 3, 2025 14:44
Copy link
Member

@martijnvg martijnvg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@gmarouli gmarouli merged commit 5918605 into elastic:main Dec 4, 2025
34 checks passed
@gmarouli gmarouli deleted the fix-multi-fields-in-downsampling branch December 4, 2025 09:56
@elasticsearchmachine
Copy link
Collaborator

💔 Backport failed

Status Branch Result
9.1 Commit could not be cherrypicked due to conflicts
8.19 Commit could not be cherrypicked due to conflicts
9.2 Commit could not be cherrypicked due to conflicts

You can use sqren/backport to manually backport by running backport --upstream elastic/elasticsearch --pr 138869

gmarouli added a commit to gmarouli/elasticsearch that referenced this pull request Dec 4, 2025
(cherry picked from commit 5918605)

# Conflicts:
#	x-pack/plugin/downsample/src/main/java/org/elasticsearch/xpack/downsample/AggregateSubMetricFieldValueFetcher.java
#	x-pack/plugin/downsample/src/main/java/org/elasticsearch/xpack/downsample/DownsampleShardIndexer.java
#	x-pack/plugin/downsample/src/main/java/org/elasticsearch/xpack/downsample/FieldValueFetcher.java
#	x-pack/plugin/downsample/src/main/java/org/elasticsearch/xpack/downsample/RestDownsampleAction.java
#	x-pack/plugin/downsample/src/main/java/org/elasticsearch/xpack/downsample/TransportDownsampleAction.java
gmarouli added a commit to gmarouli/elasticsearch that referenced this pull request Dec 4, 2025
(cherry picked from commit 5918605)

# Conflicts:
#	server/src/main/resources/transport/upper_bounds/9.2.csv
#	server/src/main/resources/transport/upper_bounds/9.3.csv
#	x-pack/plugin/downsample/src/main/java/org/elasticsearch/xpack/downsample/AggregateSubMetricFieldValueFetcher.java
#	x-pack/plugin/downsample/src/main/java/org/elasticsearch/xpack/downsample/DownsampleShardIndexer.java
#	x-pack/plugin/downsample/src/main/java/org/elasticsearch/xpack/downsample/FieldValueFetcher.java
#	x-pack/plugin/downsample/src/main/java/org/elasticsearch/xpack/downsample/RestDownsampleAction.java
#	x-pack/plugin/downsample/src/main/java/org/elasticsearch/xpack/downsample/TransportDownsampleAction.java
#	x-pack/plugin/downsample/src/test/java/org/elasticsearch/xpack/downsample/DownsampleShardPersistentTaskExecutorTests.java
@gmarouli
Copy link
Contributor Author

gmarouli commented Dec 4, 2025

💔 Some backports could not be created

Status Branch Result
9.2
9.1
8.19

Manual backport

To create the backport manually run:

backport --pr 138869

Questions ?

Please refer to the Backport tool documentation

gmarouli added a commit that referenced this pull request Dec 4, 2025
* Fix multi fields in downsampling (#138869)

(cherry picked from commit 5918605)
gmarouli added a commit that referenced this pull request Dec 4, 2025
elasticsearchmachine pushed a commit that referenced this pull request Dec 4, 2025
* [8.19] Fix multi fields in downsampling (#138869)

* Add missing capabilities
gmarouli added a commit to gmarouli/elasticsearch that referenced this pull request Dec 5, 2025
elasticsearchmachine pushed a commit that referenced this pull request Dec 5, 2025
In #138869 we fixed the handling of the multi-fields; however, we
introduced a bug when a mapping contains a alias type.

For example, the following mapping:

```
"@timestamp": {
  "type": "date"
}, 
"timestamp": {
  "type": "alias",
  "path": "@timestamp"
}
```

The cause of the bug was that in the `FieldValueFetcher` we switch the
check wether a field is indexed from the name we retrieved in the label
to the name of the field type. In this case, the label is `timestamp` 
which does not in the indexed but the name of the field type is
"@timestamp".
gmarouli added a commit to gmarouli/elasticsearch that referenced this pull request Dec 5, 2025
…tic#139104)

In elastic#138869 we fixed the handling of the multi-fields; however, we
introduced a bug when a mapping contains a alias type.

For example, the following mapping:

```
"@timestamp": {
  "type": "date"
},
"timestamp": {
  "type": "alias",
  "path": "@timestamp"
}
```

The cause of the bug was that in the `FieldValueFetcher` we switch the
check wether a field is indexed from the name we retrieved in the label
to the name of the field type. In this case, the label is `timestamp`
which does not in the indexed but the name of the field type is
"@timestamp".

(cherry picked from commit 47698be)

# Conflicts:
#	x-pack/plugin/downsample/src/internalClusterTest/java/org/elasticsearch/xpack/downsample/DownsampleIT.java
gmarouli added a commit to gmarouli/elasticsearch that referenced this pull request Dec 5, 2025
…tic#139104)

In elastic#138869 we fixed the handling of the multi-fields; however, we
introduced a bug when a mapping contains a alias type.

For example, the following mapping:

```
"@timestamp": {
  "type": "date"
},
"timestamp": {
  "type": "alias",
  "path": "@timestamp"
}
```

The cause of the bug was that in the `FieldValueFetcher` we switch the
check wether a field is indexed from the name we retrieved in the label
to the name of the field type. In this case, the label is `timestamp`
which does not in the indexed but the name of the field type is
"@timestamp".

(cherry picked from commit 47698be)

# Conflicts:
#	x-pack/plugin/downsample/src/internalClusterTest/java/org/elasticsearch/xpack/downsample/DownsampleIT.java
gmarouli added a commit that referenced this pull request Dec 5, 2025
…139111)

In #138869 we fixed the handling of the multi-fields; however, we
introduced a bug when a mapping contains a alias type.

For example, the following mapping:

```
"@timestamp": {
  "type": "date"
},
"timestamp": {
  "type": "alias",
  "path": "@timestamp"
}
```

The cause of the bug was that in the `FieldValueFetcher` we switch the
check wether a field is indexed from the name we retrieved in the label
to the name of the field type. In this case, the label is `timestamp`
which does not in the indexed but the name of the field type is
"@timestamp".

(cherry picked from commit 47698be)

# Conflicts:
#	x-pack/plugin/downsample/src/internalClusterTest/java/org/elasticsearch/xpack/downsample/DownsampleIT.java
elasticsearchmachine pushed a commit that referenced this pull request Dec 5, 2025
…139114)

In #138869 we fixed the handling of the multi-fields; however, we
introduced a bug when a mapping contains a alias type.

For example, the following mapping:

```
"@timestamp": {
  "type": "date"
},
"timestamp": {
  "type": "alias",
  "path": "@timestamp"
}
```

The cause of the bug was that in the `FieldValueFetcher` we switch the
check wether a field is indexed from the name we retrieved in the label
to the name of the field type. In this case, the label is `timestamp`
which does not in the indexed but the name of the field type is
"@timestamp".

(cherry picked from commit 47698be)

# Conflicts:
#	x-pack/plugin/downsample/src/internalClusterTest/java/org/elasticsearch/xpack/downsample/DownsampleIT.java
elasticsearchmachine pushed a commit that referenced this pull request Dec 5, 2025
…139118)

In #138869 we fixed the handling of the multi-fields; however, we
introduced a bug when a mapping contains a alias type.

For example, the following mapping:

```
"@timestamp": {
  "type": "date"
},
"timestamp": {
  "type": "alias",
  "path": "@timestamp"
}
```

The cause of the bug was that in the `FieldValueFetcher` we switch the
check wether a field is indexed from the name we retrieved in the label
to the name of the field type. In this case, the label is `timestamp`
which does not in the indexed but the name of the field type is
"@timestamp".

(cherry picked from commit 47698be)

# Conflicts:
#	x-pack/plugin/downsample/src/internalClusterTest/java/org/elasticsearch/xpack/downsample/DownsampleIT.java
mamazzol pushed a commit to mamazzol/elasticsearch that referenced this pull request Dec 5, 2025
…tic#139104)

In elastic#138869 we fixed the handling of the multi-fields; however, we
introduced a bug when a mapping contains a alias type.

For example, the following mapping:

```
"@timestamp": {
  "type": "date"
}, 
"timestamp": {
  "type": "alias",
  "path": "@timestamp"
}
```

The cause of the bug was that in the `FieldValueFetcher` we switch the
check wether a field is indexed from the name we retrieved in the label
to the name of the field type. In this case, the label is `timestamp` 
which does not in the indexed but the name of the field type is
"@timestamp".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-backport Automatically create backport pull requests when merged >bug :StorageEngine/Downsampling Downsampling (replacement for rollups) - Turn fine-grained time-based data into coarser-grained data Team:StorageEngine v8.19.9 v9.1.9 v9.2.3 v9.3.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants