Elasticsearch sum total values for specific hours within a month -


I have an elastic search server with fields: timestamp , user and bytes_down (among others)

I would like to complete a byte_down value for a user for one month but only where the hours from 8 am to 8 pm Yes,

I am able to get a daily sum with the date histogram along with the following query (I used the Perl API here I do not know one way to reduce it to the hour limit for every day.

  my $ query = {index = & gt; 'Cm', body = & gt; {Query = & gt; {Filtered = & gt; {Query = & gt; {Word = & gt; {User = & gt; $ User}}, filter = & gt; {And = & gt; [{Border = & gt; {Timestamp = & gt; {Gte = & gt; '2014-01-01', lte = & gt; '2014-01-31'}}}, {bool = & gt; {Should> & gt; {Word = & gt; {Zone = & gt; $ Zone}}}}}}}}, aspect => {Bytes_down = & gt; {Date_histogram = & gt; {Field = & gt; 'Timestamp', interval = & gt; 'Day', value_field = & gt; 'Downstream'}}}, size = & gt; 0}};   

Thanks Dell

I think you should filter instead You need to use category filter and then you have to enter the facet_filter section of your aspect:

  "Facet_filter" = & gt; {"Script" = & gt; {"Script" = & gt; "Doctor ['timestamp]] date.getHourOfDay ()> gt; = 8 & amp; amp; amp; document [' timestamp ']. Date.getHourOfDay () <20"}}    

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -