Skip to content

Commit ef11738

Browse files
authored
Fix bug introduced when we fixed multi-fields in #138869 (#139104) (#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
1 parent 054cd2f commit ef11738

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

x-pack/plugin/downsample/src/internalClusterTest/java/org/elasticsearch/xpack/downsample/DownsampleIT.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@ public void testDownsamplingPassthroughDimensions() throws Exception {
3636
{
3737
%s
3838
"properties": {
39+
"@timestamp": {
40+
"type": "date"
41+
},
42+
"timestamp": {
43+
"path": "@timestamp",
44+
"type": "alias"
45+
},
3946
"attributes": {
4047
"type": "passthrough",
4148
"priority": 10,

x-pack/plugin/downsample/src/main/java/org/elasticsearch/xpack/downsample/FieldValueFetcher.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ static List<FieldValueFetcher> create(SearchExecutionContext context, String[] f
101101
}
102102
}
103103
} else {
104-
if (context.fieldExistsInIndex(fieldType.name())) {
104+
if (context.fieldExistsInIndex(field)) {
105105
final IndexFieldData<?> fieldData;
106106
if (fieldType instanceof FlattenedFieldMapper.RootFlattenedFieldType flattenedFieldType) {
107107
var keyedFieldType = flattenedFieldType.getKeyedFieldType();

0 commit comments

Comments
 (0)