这是我解决问题的方法。希望这可以帮助。(参考https://www.elastic.co/guide/en/elasticsearch/client/net-
api/1.x/scroll.html,https://www.elastic.co/guide/en/elasticsearch/reference/
current / search-request-scroll.html#scroll-search-
context)
List<string> indexedList = new List<string>();var scanResults = client.Search<ClassName>(s => s .From(0) .Size(2000) .MatchAll() .Fields(f=>f.Field(fi=>fi.propertyName)) //I used field to get only the value I needed rather than getting the whole document .SearchType(Elasticsearch.Net.SearchType.Scan) .Scroll("5m") ); var results = client.Scroll<ClassName>("10m", scanResults.ScrollId); while (results.documents.Any()) { foreach(var doc in results.Fields) { indexedList.Add(doc.Value<string>("propertyName")); } results = client.Scroll<ClassName>("10m", results.ScrollId); }编辑
var response = client.Search<document>(s => s .From(fromNum) .Size(PageSize) .Query(q => q ....



