I noticed that when running the following dsl query search on the cli console for ElasticSearch that it will only return a few of the records. If I add a "size": 3000, then I will be able to retrieve more than I originally got back from the dsl query search. Is there a way I could retrieve all the records without having to use size?
My query search:
GET /customer-simulation-es-app-logs*/_search
{
"_source": ["@timestamp", "messageTemplate", "message"],
"query": {
"range": {
"@timestamp": {
"gte": "2021-06-07T00:00:00Z",
"lte": "2021-06-08T00:00:00Z"
}
}
}
}
}
If I had the keyword size I retrieve more than the first search I did above:
GET /customer-simulation-es-app-logs*/_search
{
"_source": ["@timestamp", "messageTemplate", "message"],
"size": 3000,
"query": {
"range": {
"@timestamp": {
"gte": "2021-06-07T00:00:00Z",
"lte": "2021-06-08T00:00:00Z"
}
}
}
}
}
Here is my elasticsearch nest portion so you can get an idea of how I have it:
var response = await _elasticClient.SearchAsync<EsSource>(s => s
.Size(3000) // must see about this
.Source(src => src.Includes(i => i
.Fields(f => f.timestamp,
fields => fields.messageTemplate,
fields => fields.message)))
.Index("customer-simulation-es-app-logs*")
.Query(q => +q
.DateRange(dr => dr
.Field("@timestamp")
.GreaterThanOrEquals("2021-06-07T17:13:54.414-05:00")
.LessThanOrEquals(DateTime.Now))));
EsSource
public class EsSource
{
[Date(Name = "@timestamp")]
public DateTimeOffset timestamp { get; set; }
public String messageTemplate { get; set; }
public String message { get; set; }
}