added support for doc_as_upsert fix #368