Implemented upsertDocument() in elasticsearch.