The field whose name matches doc_type doesn't always exist now, thanks to commit b61d9c2; guard against it not being present