我正在尝试通过C#代码读取Elastic搜索日志 它包含许多参数,例如排序查询大小滚动 我想优化搜索时间 任何输入均受到高度赞赏
下面是当前可用的代码
var searchResult = client.Search<Logs>(s => s.Index(configurationModel.SearchIndex)
.Type(configurationModel.SearchRequestParameter)
.Sort(n => n.Ascending(configurationModel.SortOnField))
.Size(Convert.ToInt32(configurationModel.ElasticSearchDataChunkSize))
.Scroll(configurationModel.ScrollTime)
.Query(x => !x.Exists(a => a.Field("Category"))
&& x.Match(b => b.Field(configurationModel.SourceProductionFilterKey)
.Query(configurationModel.WebApiServer))
&& x.Term(d => d.Field(configurationModel.SortOnField)
.GreaterThanOrEquals(GetFormattedDate("startDate"))
.LessThanOrEquals(GetFormattedDate("endDate"))
)));