Is there a way to use a facet so that it creates a histogram on every X occurrences in a sequence?


(redCashion) #1

I'm not seeing how this would be done, but is it possible to have a facet that instead of using date_interval, uses an interval to give the stats on every X number of occurrences? I have tried doing it like:

"value_field": "date",
"key_field": "net",
"interval": 1000

But it returns the histogram as groupings of net being in 1000 (ie a bucket for all nets between -1000 and 0, etc).

If I reverse the key_field and value_field I get the entire dataset back.


(redCashion) #2

As an example, if net was a sequence of numbers ordered by date like:

1,2,3,4,5,6,7
and I set the interval to 2, I would like to get back a histogram like:

count: 2
value: 3,

count: 2,
value: 7,

count: 2,
value: 11,


(Shay Banon) #3

Still cryptic..., I am not sure I understand, but won't histogram facet
with interval set to 2 on net will do it for you?

On Fri, May 4, 2012 at 1:19 AM, redCashion xperts@gmail.com wrote:

As an example, if net was a sequence of numbers ordered by date like:

1,2,3,4,5,6,7
and I set the interval to 2, I would like to get back a histogram like:

count: 2
value: 3,

count: 2,
value: 7,

count: 2,
value: 11,

--
View this message in context:
http://elasticsearch-users.115913.n3.nabble.com/Is-there-a-way-to-use-a-facet-so-that-it-creates-a-histogram-on-every-X-occurrences-in-a-sequence-tp3960603p3960626.html
Sent from the ElasticSearch Users mailing list archive at Nabble.com.


(Chris Conley) #4

Shay, I have a similar need and I believe you're correct with setting an
interval of 2 in Jeremy's case.

Is there a way to accomplish the same thing but with out a field like
"net"? (ex: facet on groups of 100 ordered by date)

Or do I need to always maintain a "counter" field like Jeremy's "net" field?

Thanks!
Chris

On Friday, May 4, 2012 9:42:42 AM UTC-4, kimchy wrote:

Still cryptic..., I am not sure I understand, but won't histogram facet
with interval set to 2 on net will do it for you?

On Fri, May 4, 2012 at 1:19 AM, redCashion <xpe...@gmail.com <javascript:>

wrote:

As an example, if net was a sequence of numbers ordered by date like:

1,2,3,4,5,6,7
and I set the interval to 2, I would like to get back a histogram like:

count: 2
value: 3,

count: 2,
value: 7,

count: 2,
value: 11,

--
View this message in context:
http://elasticsearch-users.115913.n3.nabble.com/Is-there-a-way-to-use-a-facet-so-that-it-creates-a-histogram-on-every-X-occurrences-in-a-sequence-tp3960603p3960626.html
Sent from the ElasticSearch Users mailing list archive at Nabble.com.

--


(system) #5