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
[7.5][ML] Prevent fetching multi-field from source (#48770) (#48798)
Aggregatable mutli-fields are at the moment wrongly mapped
as normal doc_value fields and thus they support fetching from
source. However, they do not exist in the source. This results
to failure to extract such fields.
This commit fixes this bug. While a fix could be worked out
on top of the existing code, it is evident the extraction logic
has become difficult to understand and maintain. As we also
want to deduplicate multi-fields for data frame analytics,
it seemed appropriate to refactor the code to simplify and
better handle the extraction of multi-fields.
Relates #48756
Backport of #48770
Copy file name to clipboardExpand all lines: x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/DatafeedJobsRestIT.java
Copy file name to clipboardExpand all lines: x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/datafeed/extractor/scroll/ScrollDataExtractor.java
Copy file name to clipboardExpand all lines: x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/datafeed/extractor/scroll/SearchHitToJsonProcessor.java
+1-1
Original file line number
Diff line number
Diff line change
@@ -29,7 +29,7 @@ class SearchHitToJsonProcessor implements Releasable {
Copy file name to clipboardExpand all lines: x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/datafeed/extractor/scroll/TimeBasedExtractedFields.java
+8-11
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,6 @@
14
14
15
15
importjava.util.ArrayList;
16
16
importjava.util.Arrays;
17
-
importjava.util.Collections;
18
17
importjava.util.List;
19
18
importjava.util.Objects;
20
19
importjava.util.Set;
@@ -42,13 +41,13 @@ public String timeField() {
42
41
publicLongtimeFieldValue(SearchHithit) {
43
42
Object[] value = timeField.value(hit);
44
43
if (value.length != 1) {
45
-
thrownewRuntimeException("Time field [" + timeField.getAlias() + "] expected a single value; actual was: "
44
+
thrownewRuntimeException("Time field [" + timeField.getName() + "] expected a single value; actual was: "
46
45
+ Arrays.toString(value));
47
46
}
48
47
if (value[0] instanceofLong) {
49
48
return (Long) value[0];
50
49
}
51
-
thrownewRuntimeException("Time field [" + timeField.getAlias() + "] expected a long value; actual was: " + value[0]);
50
+
thrownewRuntimeException("Time field [" + timeField.getName() + "] expected a long value; actual was: " + value[0]);
Copy file name to clipboardExpand all lines: x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/dataframe/extractor/ExtractedFieldsDetector.java
0 commit comments