_source could be loaded twice from disk
if only partial_fields was specified or fields needed to be extracted from _source the source it self isn't needed to be returned.
This commit is contained in:
parent
2dcc664310
commit
98bd5a0e66
|
@ -22,7 +22,6 @@ package org.elasticsearch.search.fetch;
|
|||
import com.google.common.collect.ImmutableMap;
|
||||
import org.apache.lucene.index.AtomicReaderContext;
|
||||
import org.apache.lucene.index.ReaderUtil;
|
||||
import org.elasticsearch.common.bytes.BytesArray;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.text.StringAndBytesText;
|
||||
import org.elasticsearch.common.text.Text;
|
||||
|
@ -170,8 +169,8 @@ public class FetchPhase implements SearchPhase {
|
|||
// go over and extract fields that are not mapped / stored
|
||||
context.lookup().setNextReader(subReaderContext);
|
||||
context.lookup().setNextDocId(subDoc);
|
||||
if (searchHit.source() != null) {
|
||||
context.lookup().source().setNextSource(new BytesArray(searchHit.source()));
|
||||
if (fieldsVisitor.source() != null) {
|
||||
context.lookup().source().setNextSource(fieldsVisitor.source());
|
||||
}
|
||||
if (extractFieldNames != null) {
|
||||
for (String extractFieldName : extractFieldNames) {
|
||||
|
|
Loading…
Reference in New Issue