Currently in non reactive code refreshes are done for repository functions, not for template operations. This leads to an extra call to ES when repository functions are used, although it may not be in the user's intent.
In the reactive code, the refresh handling can be configured in the configuration class. We should do the same in non-reactive code, this would allow us to:
pass the refresh parameter in the actual code
only do the refresh if the user wants it
We should introduce an enum that mirrors org.elasticsearch.action.support.WriteRequest.RefreshPolicy to keep ES namespace out of the API (for the reactive part as well) and provide a refresh policy for the template by means of the configuration support.
For the template, the refresh policy is passed on to Elasticsearch if it is not null, otherwise the template does nothing special so the cluster will use it's default.
For the repositories, if the refresh policy is null, then the repository will call an explicit refresh after write operations and so provide the same behaviour as up to now