private Task RefreshForConsistency(IRepositoryQuery query, ICommandOptions options)
        {
            // all docs are saved with immediate or wait consistency, no need to force a refresh
            if (DefaultConsistency != Consistency.Eventual)
            {
                return(Task.CompletedTask);
            }

            // if using immediate consistency, force a refresh before query
            if (options.GetConsistency() == Consistency.Immediate)
            {
                var indices = ElasticIndex.GetIndexesByQuery(query);
                return(_client.Indices.RefreshAsync(indices));
            }

            return(Task.CompletedTask);
        }
 public static Refresh GetRefreshMode(this ICommandOptions options, Consistency defaultMode = Consistency.Eventual)
 {
     return(ToRefresh(options.GetConsistency(defaultMode)));
 }