- I need to find the log with jobid xxx, but the result is different every time after running the following code;
- I want to use the CreateTime field in reverse order, the following code is not successful;
- I want to implement fuzzy query, but did not understand the example of elastic docs;
Please help me point out the problem in the code,thanks
var searchResponse = await client.SearchAsync < JobElasticDto > (w =>
w.Query(q => q
.Match(m => m
.Field(f => f
.JobInfoId)
.Query(input.JobId.ToString())
)
)
.From(input.SkipCount)
.Size(input.MaxResultCount)
.Sort(w => w.Descending(p => p.CreateTime))
.Query(w =>
{
if(!string.IsNullOrEmpty(input.SourceType))
{
return w.Match(p => p.Field(q => q.SourceType == input.SourceType));
}
return null;
}).Query(w =>
{
if(!string.IsNullOrEmpty(input.Keywords))
{
return w.Match(p => p.Field(q => q.Message.Contains(input.Keywords)));
}
return null;
}));