I need to retrieve the number of records from a Machine of a certain Type during the date of 7 am and 7 am the next day (24 hour period)
This is the structure of my document:
//Date is in Ticks
public Long Date { get; set; }
public string Process { get; set; }
public string Type { get; set; }
public int Index { get; set; }
public string Machine { get; set; }
public string Plant { get; set; }
public string Body { get; set; }
public int Hour { get; set; }
public string key{ get; set;}
The query I'm currently using is
session.Query<Warning>("GetWarningCountByTypeAndMachine").Statistics(out stats)
.Where(x => x.Machine.Equals(MachineName, StringComparison.OrdinalIgnoreCase) && x.Type.Equals(WarningType, StringComparison.OrdinalIgnoreCase) && x.Date >= date_begin.Ticks && x.Date <= date_end.Ticks).ToList();
where GetWarningCountByTypeAndMachine is just:
from doc in docs
select new { Machine = doc.Machine, Type = doc.Type, Date = doc.Date }
Is there any way to make a reduction or just any faster way to query this?