if (!getResult.exists()) {
throw new ElasticSearchIllegalArgumentException("Document not found, cannot render view");
}
// Try to get a view stored at document level
ViewContext viewContext = extract(getResult.sourceAsMap(), request.format());
if (viewContext == null) {
// Then, get the view stored in the mapping _meta field
MappingMetaData mappingMetaData = clusterService.state().metaData().index(request.index()).mapping(request.type());
if (mappingMetaData != null) {