elasticsearch - How can I get FacetFilter work properly? -
i'm trying calculate stats elasticsearch short time period but, eventhough specified interval, i'm still getting results whole data set.
this code
var mindate = new datetime(1970, 1, 1); var fromdate = datetime.parse("2014-11-27t11:00:00.000z").addticks(-mindate.ticks).addhours(-2); var todate = datetime.parse("2014-11-27t11:15:00.000z").addticks(-mindate.ticks).addhours(-2); var results = client.search<dalsp>(s => s .from(0) .size(100) .facettermsstats(fts => fts .facetfilter(fdesc => fdesc .range(range => range.greater(fromdate.ticks / 10000).lower(todate.ticks / 10000) ) ) .keyfield(t => t.sp_name) .valuefield(t => t.total_time) ) );
what can problem? in advance.
problem solved after using strings timestamp, instead of long.
var results = client.search<dalsp>(s => s .from(0) .size(100) .query(q => q.range(range => range.onfield("@timestamp").lowerorequals(enddatestr).greaterorequals(startdatestr)) ) .facettermsstats(fts => fts .keyfield(t => t.sp_name) .valuefield(t => t.total_time) ) );
Comments
Post a Comment