public async Task <string> SDK() { // 使用SDK方式无法获取到5千条数据,出现bug // Unable to get 5000 pieces of data using SDK, bug var now = DateTime.Now; var multiSearchRequest = new MultiSearchDescriptor(); multiSearchRequest.MaxConcurrentSearches(5000); for (int i = 0; i < 5000; i++) { // 前一时间 multiSearchRequest = multiSearchRequest.Search <GatewayDevicePoint_ES>(s => s .From(0) .Size(1) //.Timeout("6000") .Sort(st => st .Descending(new Field(nameof(GatewayDevicePoint_ES.TimeTicks))) ) .Query(q => q .Bool(b => b .Must(mu => mu .MatchPhrasePrefix(m => m .Field(new Field(nameof(GatewayDevicePoint_ES.PointId))) .Query("007e1f1f9932408da100aa0306401a4e_214") ) ) .Filter(f => f .LongRange(r => r .Field(new Field(nameof(GatewayDevicePoint_ES.TimeTicks))) .LessThanOrEquals(now.AddSeconds(-1 * i).ToUniversalTime().Ticks) ), f => f .Bool(fb => fb .MustNot(mn => mn .Term(t => t .Field(new Field(nameof(GatewayDevicePoint_ES.TimeTicks))) .Value(0) ) ) ) ) ) ) ); } var result = string.Empty; try { var response = _elasticClient.MultiSearch(multiSearchRequest); if (!response.IsValid) { result = response.DebugInformation; } else { result = "The amount of data is too small to reproduce the bug. Please increase the amount of inserted data in the static constructor" + Environment.NewLine + "数据量太少,无法重现bug,请在静态构造函数中扩大插入数据量"; } } catch (Exception ex) { result = ex.ToString(); } return(await Task.FromResult(result)); }