diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/fetch/FetchPhase.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/fetch/FetchPhase.java index 24fc28764b4..88addc6cc1f 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/fetch/FetchPhase.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/fetch/FetchPhase.java @@ -180,7 +180,7 @@ public class FetchPhase implements SearchPhase { // go over and extract fields that are not mapped / stored context.lookup().setNextReader(subReader); - context.lookup().setNextDocId(docId); + context.lookup().setNextDocId(subDoc); if (extractFieldNames != null) { for (String extractFieldName : extractFieldNames) { Object value = context.lookup().source().extractValue(extractFieldName);