小编典典
List indexedList = new List();
var scanResults = client.Search(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("10m", scanResults.ScrollId);
while (results.Documents.Any())
{
foreach(var doc in results.Fields)
{
indexedList.Add(doc.Value("propertyName"));
}
results = client.Scroll("10m", results.ScrollId);
}
编辑
var response = client.Search(s => s
.From(fromNum)
.Size(PageSize)
.Query(q => q ....
2020-06-22