Pretty up the formatting a bit for docs_in_es

Also look up doc_type on es_doc if couch_doc doesn't exist
Merge pull request #4497 from dimagi/doc_in_es

Pretty up the formatting a bit for docs_in_es