public static List <HintWord> GetHints(HintSection section) { var hints = GetCities().Select(word => new HintWord(section, word)).ToList(); var count = hints.Count; return(hints); }
public async Task <BulkResponse> LoadCitiesAsHints() { var section = (await GetHintSections()).FirstOrDefault(); if (section is null) { section = new HintSection("hello world"); await SaveSection(section); } var hints = Cities.GetHints(section); int bulkAmount = 10000; for (var i = 0; hints.Count > i; i += bulkAmount) { var selectedHints = hints.Skip(i).Take(bulkAmount).ToList(); var response = _elasticClient.Bulk(x => x .Index(hintWordIndex) .IndexMany(selectedHints)); } return(null); }
public async Task SaveSection(HintSection section) { var response = await _elasticClient.IndexAsync(section, x => x.Index(sectionWordIndex)); }