Send the update-mapping events before actually indexing into the shard, because the latter may generate exceptions (like when the shard is not yet ready to accept new docs).

Also improved the SimpleDeleteMappingTest, as it make take a while until the update-mapping event is processed.

Closes #3782
Returning useful exception when sorting on a completion field

Closes #3747