Skip to content

Commit e4b36ac

Browse files
comment and more
1 parent f73ae69 commit e4b36ac

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

server/src/main/java/org/elasticsearch/search/SearchHit.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -726,9 +726,12 @@ private void deallocate() {
726726
SearchHit.this.source = null;
727727
clearIfMutable(documentFields);
728728
clearIfMutable(metaFields);
729+
this.highlightFields = null;
729730
}
730731

731732
private static void clearIfMutable(Map<String, DocumentField> fields) {
733+
// check that we're dealing with a HashMap, instances read from the wire that are empty be of an immutable type
734+
assert fields instanceof HashMap<?, ?> || fields.isEmpty() : fields;
732735
if (fields instanceof HashMap<?, ?> hm) {
733736
hm.clear();
734737
}

0 commit comments

Comments
 (0)