improve failure message when not finding _uid field in the doc
This commit is contained in:
parent
42edd0c864
commit
9876fa5a76
|
@ -53,6 +53,7 @@ import org.elasticsearch.search.internal.SearchContext;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -172,8 +173,12 @@ public class FetchPhase implements SearchPhase {
|
||||||
if (sUid != null) {
|
if (sUid != null) {
|
||||||
return Uid.createUid(sUid);
|
return Uid.createUid(sUid);
|
||||||
}
|
}
|
||||||
// no type, nothing to do (should not really happen
|
// no type, nothing to do (should not really happen)
|
||||||
throw new FetchPhaseExecutionException(context, "Failed to load uid from the index");
|
List<String> fieldNames = new ArrayList<String>();
|
||||||
|
for (Fieldable field : doc.getFields()) {
|
||||||
|
fieldNames.add(field.name());
|
||||||
|
}
|
||||||
|
throw new FetchPhaseExecutionException(context, "Failed to load uid from the index, missing internal _uid field, current fields in the doc [" + fieldNames + "]");
|
||||||
}
|
}
|
||||||
|
|
||||||
private Document loadDocument(SearchContext context, FieldSelector fieldSelector, int docId) {
|
private Document loadDocument(SearchContext context, FieldSelector fieldSelector, int docId) {
|
||||||
|
|
Loading…
Reference in New Issue