Skip to content

Commit 7bb350e

Browse files
author
Christoph Büscher
committed
fix tests
1 parent 08f919f commit 7bb350e

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

server/src/main/java/org/elasticsearch/index/query/InnerHitBuilder.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ public InnerHitBuilder addFetchField(String name) {
396396
* @param format an optional format string used when formatting values, for example a date format.
397397
*/
398398
public InnerHitBuilder addFetchField(String name, @Nullable String format) {
399-
return addFetchField(name, format, false);
399+
return addFetchField(name, format, null);
400400
}
401401

402402
/**
@@ -405,11 +405,11 @@ public InnerHitBuilder addFetchField(String name, @Nullable String format) {
405405
* @param format an optional format string used when formatting values, for example a date format.
406406
* @param includeUnmapped whether unmapped fields should be returned as well
407407
*/
408-
public InnerHitBuilder addFetchField(String name, @Nullable String format, boolean includeUnmapped) {
408+
public InnerHitBuilder addFetchField(String name, @Nullable String format, Boolean includeUnmapped) {
409409
if (fetchFields == null || fetchFields.isEmpty()) {
410410
fetchFields = new ArrayList<>();
411411
}
412-
fetchFields.add(new FieldAndFormat(name, format, Optional.of(includeUnmapped)));
412+
fetchFields.add(new FieldAndFormat(name, format, Optional.ofNullable(includeUnmapped)));
413413
return this;
414414
}
415415

server/src/main/java/org/elasticsearch/search/fetch/subphase/FieldAndFormat.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
7474
builder.field(FORMAT_FIELD.getPreferredName(), format);
7575
}
7676
if (this.includeUnmapped.isPresent()) {
77-
builder.field(INCLUDE_UNMAPPED_FIELD.getPreferredName(), includeUnmapped);
77+
builder.field(INCLUDE_UNMAPPED_FIELD.getPreferredName(), includeUnmapped.get());
7878
}
7979
builder.endObject();
8080
return builder;
@@ -133,6 +133,6 @@ public boolean equals(Object obj) {
133133
return false;
134134
}
135135
FieldAndFormat other = (FieldAndFormat) obj;
136-
return field.equals(other.field) && Objects.equals(format, other.format) && Objects.equals(includeUnmapped,other.includeUnmapped);
136+
return field.equals(other.field) && Objects.equals(format, other.format) && Objects.equals(includeUnmapped, other.includeUnmapped);
137137
}
138138
}

server/src/main/java/org/elasticsearch/search/fetch/subphase/FieldFetcher.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ public static FieldFetcher create(QueryShardContext context,
6868
continue;
6969
}
7070
ValueFetcher valueFetcher = ft.valueFetcher(context, format);
71+
mappedToExclude.add(field);
7172
fieldContexts.add(new FieldContext(field, valueFetcher));
7273
}
7374
}

0 commit comments

Comments
 (0)