Update API enhancement - add support for scripted upserts.

In the case of inserts the UpdateHelper class will now allow the script used to apply updates to run on the upsert doc provided by clients. This allows the logic for managing the internal state of the data item to be managed by the script and is not reliant on clients performing the initialisation of data structures managed by the script.
Associated issue: https://github.com/elasticsearch/elasticsearch/issues/7143
maybe add some whitespaces in this if statement (between if and ( and &&)? looks very compact now.