protected virtual async Task <SearchDescriptor <T> > ConfigureSearchDescriptorAsync(SearchDescriptor <T> search, IRepositoryQuery query, ICommandOptions options) { search ??= new SearchDescriptor <T>(); query = ConfigureQuery(query.As <T>()).Unwrap(); var indices = ElasticIndex.GetIndexesByQuery(query); if (indices?.Length > 0) { search.Index(String.Join(",", indices)); } if (HasVersion) { search.SequenceNumberPrimaryTerm(HasVersion); } search.IgnoreUnavailable(); search.TrackTotalHits(); await ElasticIndex.QueryBuilder.ConfigureSearchAsync(query, options, search).AnyContext(); return(search); }