Term Faceting in Date Buckets (ala Date Histogram)


(Anthony D.) #1

Hey ES gurus -
I'm trying to write an ElasticSearch query which in effect amounts to a
combination of a traditional term facet and a date histogram facet. I
thought that the date histogram facet may be exactly what I need here, but
from what I can tell it only seems to work on numeric field types,
providing statistical (or scripted) analysis on the values of the field in
question. While there's hack-ish ways around this, I'm hoping that there's
still a way to get what I'm going for using the built in functionality
which would typically also be the most efficient way to solve this problem.

Instead of doing statistical analysis on a numeric field with the date
histogram facet, I just need a count of the top(n) terms, bucketed by date
interval. Can this be done using existing functionality, is this
functionality planned, or does anybody have any suggestions on the most
efficient way to go about this particular problem?

Thanks greatly -
~Anthony

--


(Boaz Leskes) #2

Hi Anthony,

This is not possible with standard ElasticSearch. We needed a similar thing on my work and I wrote a plugin to add a facet type that allows combining date histograms with any other facet. It is still work in progress but it works. You can check it out on https://github.com/bleskes/elasticfacets

Cheers,
Boaz

--


(Anthony D.) #3

Boaz -
Thanks a ton! I'll see how this fits in and send you back any updates or
feedback. :slight_smile:

~Anthony

On Monday, October 1, 2012 10:19:27 PM UTC-7, Boaz Leskes wrote:

Hi Anthony,

This is not possible with standard ElasticSearch. We needed a similar
thing on my work and I wrote a plugin to add a facet type that allows
combining date histograms with any other facet. It is still work in
progress but it works. You can check it out on
https://github.com/bleskes/elasticfacets

Cheers,
Boaz

--


(Chenryn) #4

I try to install plugin in my cluster and curl the example json but get 'No
facet type found for [faceted_date_histogram]'. Should I do anything else
before using search?

2012/10/2 Boaz Leskes b.leskes@gmail.com

Hi Anthony,

This is not possible with standard ElasticSearch. We needed a similar
thing on my work and I wrote a plugin to add a facet type that allows
combining date histograms with any other facet. It is still work in
progress but it works. You can check it out on
https://github.com/bleskes/elasticfacets

Cheers,
Boaz

--

--


(Boaz Leskes) #5

Other then restarting the ES cluster I don't think so. The plugin should
log when it is loaded:

logger.info("ElasticFacets plugin initialized");

Do you see that in the log file?

Just to be sure - you are using ES version 0.19.8 or higher?

On Tuesday, October 2, 2012 11:46:16 AM UTC+2, chenlin rao wrote:

I try to install plugin in my cluster and curl the example json but get
'No facet type found for [faceted_date_histogram]'. Should I do anything
else before using search?

2012/10/2 Boaz Leskes <b.le...@gmail.com <javascript:>>

Hi Anthony,

This is not possible with standard ElasticSearch. We needed a similar
thing on my work and I wrote a plugin to add a facet type that allows
combining date histograms with any other facet. It is still work in
progress but it works. You can check it out on
https://github.com/bleskes/elasticfacets

Cheers,
Boaz

--

--


(Chenryn) #6

Yes, ES version 0.19.8. And I see log like
"[2012-10-02 17:30:02,263][INFO ][plugins ] [Quasar II]
loaded [river-rabbitmq], sites [head, elasticfacets]
[2012-10-02 17:30:05,552][INFO ][node ] [Quasar II]
{0.19.8}[31031]: initialized
[2012-10-02 17:30:05,552][INFO ][node ] [Quasar II]
{0.19.8}[31031]: starting ...
"

2012/10/2 Boaz Leskes b.leskes@gmail.com

Other then restarting the ES cluster I don't think so. The plugin should
log when it is loaded:

logger.info("ElasticFacets plugin initialized");

Do you see that in the log file?

Just to be sure - you are using ES version 0.19.8 or higher?

On Tuesday, October 2, 2012 11:46:16 AM UTC+2, chenlin rao wrote:

I try to install plugin in my cluster and curl the example json but get
'No facet type found for [faceted_date_histogram]'. Should I do anything
else before using search?

2012/10/2 Boaz Leskes b.le...@gmail.com

Hi Anthony,

This is not possible with standard ElasticSearch. We needed a similar
thing on my work and I wrote a plugin to add a facet type that allows
combining date histograms with any other facet. It is still work in
progress but it works. You can check it out on
https://github.com/bleskes/**elasticfacetshttps://github.com/bleskes/elasticfacets

Cheers,
Boaz

--

--

--


(Boaz Leskes) #7

I see the problem. It thinks elasticfacets is a site plugin (thus html and
not java). I also see that I only have binaries ready for version 0.19.9
(version we have in production). I'll try to compile asap but I can't do it
tonight. Is there any chance you can upgrade?

On Tuesday, October 2, 2012 4:07:03 PM UTC+2, chenlin rao wrote:

Yes, ES version 0.19.8. And I see log like
"[2012-10-02 17:30:02,263][INFO ][plugins ] [Quasar II]
loaded [river-rabbitmq], sites [head, elasticfacets]
[2012-10-02 17:30:05,552][INFO ][node ] [Quasar II]
{0.19.8}[31031]: initialized
[2012-10-02 17:30:05,552][INFO ][node ] [Quasar II]
{0.19.8}[31031]: starting ...
"

2012/10/2 Boaz Leskes <b.le...@gmail.com <javascript:>>

Other then restarting the ES cluster I don't think so. The plugin should
log when it is loaded:

logger.info("ElasticFacets plugin initialized");

Do you see that in the log file?

Just to be sure - you are using ES version 0.19.8 or higher?

On Tuesday, October 2, 2012 11:46:16 AM UTC+2, chenlin rao wrote:

I try to install plugin in my cluster and curl the example json but get
'No facet type found for [faceted_date_histogram]'. Should I do anything
else before using search?

2012/10/2 Boaz Leskes b.le...@gmail.com

Hi Anthony,

This is not possible with standard ElasticSearch. We needed a similar
thing on my work and I wrote a plugin to add a facet type that allows
combining date histograms with any other facet. It is still work in
progress but it works. You can check it out on
https://github.com/bleskes/**elasticfacetshttps://github.com/bleskes/elasticfacets

Cheers,
Boaz

--

--

--


(Chenryn) #8

ok, I will try to upgrade ~tks

2012/10/2 Boaz Leskes b.leskes@gmail.com

I see the problem. It thinks elasticfacets is a site plugin (thus html and
not java). I also see that I only have binaries ready for version 0.19.9
(version we have in production). I'll try to compile asap but I can't do it
tonight. Is there any chance you can upgrade?

On Tuesday, October 2, 2012 4:07:03 PM UTC+2, chenlin rao wrote:

Yes, ES version 0.19.8. And I see log like
"[2012-10-02 17:30:02,263][INFO ][plugins ] [Quasar II]
loaded [river-rabbitmq], sites [head, elasticfacets]
[2012-10-02 17:30:05,552][INFO ][node ] [Quasar II]
{0.19.8}[31031]: initialized
[2012-10-02 17:30:05,552][INFO ][node ] [Quasar II]
{0.19.8}[31031]: starting ...
"

2012/10/2 Boaz Leskes b.le...@gmail.com

Other then restarting the ES cluster I don't think so. The plugin should

log when it is loaded:

logger.info("ElasticFacets plugin initialized");

Do you see that in the log file?

Just to be sure - you are using ES version 0.19.8 or higher?

On Tuesday, October 2, 2012 11:46:16 AM UTC+2, chenlin rao wrote:

I try to install plugin in my cluster and curl the example json but get
'No facet type found for [faceted_date_histogram]'. Should I do anything
else before using search?

2012/10/2 Boaz Leskes b.le...@gmail.com

Hi Anthony,

This is not possible with standard ElasticSearch. We needed a similar
thing on my work and I wrote a plugin to add a facet type that allows
combining date histograms with any other facet. It is still work in
progress but it works. You can check it out on
https://github.com/bleskes/elasticfacetshttps://github.com/bleskes/elasticfacets

Cheers,
Boaz

--

--

--

--


(Boaz Leskes) #9

Hi Cehnlin (and Anthony),

I've repackaged the plugin with a version for 0.19.8 as well. If you still
run 0.19.8, you can install it using bin/plugin -install
bleskes/elasticfacets/0.1 . Please let me know if it worked out for you.

Cheers,
Boaz

On Tuesday, October 2, 2012 5:59:46 PM UTC+2, chenlin rao wrote:

ok, I will try to upgrade ~tks

2012/10/2 Boaz Leskes <b.le...@gmail.com <javascript:>>

I see the problem. It thinks elasticfacets is a site plugin (thus html
and not java). I also see that I only have binaries ready for version
0.19.9 (version we have in production). I'll try to compile asap but I
can't do it tonight. Is there any chance you can upgrade?

On Tuesday, October 2, 2012 4:07:03 PM UTC+2, chenlin rao wrote:

Yes, ES version 0.19.8. And I see log like
"[2012-10-02 17:30:02,263][INFO ][plugins ] [Quasar II]
loaded [river-rabbitmq], sites [head, elasticfacets]
[2012-10-02 17:30:05,552][INFO ][node ] [Quasar II]
{0.19.8}[31031]: initialized
[2012-10-02 17:30:05,552][INFO ][node ] [Quasar II]
{0.19.8}[31031]: starting ...
"

2012/10/2 Boaz Leskes b.le...@gmail.com

Other then restarting the ES cluster I don't think so. The plugin should

log when it is loaded:

logger.info("ElasticFacets plugin initialized");

Do you see that in the log file?

Just to be sure - you are using ES version 0.19.8 or higher?

On Tuesday, October 2, 2012 11:46:16 AM UTC+2, chenlin rao wrote:

I try to install plugin in my cluster and curl the example json but
get 'No facet type found for [faceted_date_histogram]'. Should I do
anything else before using search?

2012/10/2 Boaz Leskes b.le...@gmail.com

Hi Anthony,

This is not possible with standard ElasticSearch. We needed a similar
thing on my work and I wrote a plugin to add a facet type that allows
combining date histograms with any other facet. It is still work in
progress but it works. You can check it out on
https://github.com/bleskes/elasticfacetshttps://github.com/bleskes/elasticfacets

Cheers,
Boaz

--

--

--

--


(system) #10