Start, end and gap in Price using Aggregations


(hari) #1

I have been experimenting with the new aggregations feature and I'm
wondering if this use case is possible
Sample gist and Sample Query is available here.

This will generate Sample Price Facet in the UI
Price
0 - 5 (1)
5 - 10 (2)
10 - 20 (1)
20 - 30 (2)

As you can see I'm defining the price range in the query, this is more or
less static or in other words when I query for a products in a category I
should know the start, end and gap for price in a given category to
generate meaningful price ranges.

Question:

How do I set up a facet which takes into account the actual values of the

prices field (min, max from search context) and sets up ranges dynamically,
may be based on some rules?.

This turns out to be a typical use case for ecommerce domain, where in my

products in a category may have dynamic range and I don't know start,end or
gap.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/d8514ed4-9e0c-4b0a-8ae9-1db637dde841%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Alexander Reelsen) #2

Hey,

you cannot do this at the moment. And let me explain briefly why I think it
is a bad idea (as it is very use-case dependent).

First having such buckets requires to run over all documents for every
query and find the lowest, highest and average price (oh, which one btw,
average, median, anything else?), as new documents might have been added in
the meantime.

How useful are those buckets? If you have one product, which is
extraordinary expensive (that bugatti in your car list), suddenly all your
buckets will based on that max value. Yes, you could smoothe it, adding
more calculations. Same goes of course for the lowest. Selling only BMWs
and have that one wrong replacement tire in your result list, will give you
a problem. If you have data, which is indexed by users, this will be hard.

Yes, most of this is solvable by algorithms, but you still want to be fast.

At a former company we tried to implement dynamic buckets, and we failed
horribly (not in terms of the result, but in terms of the user experience).
We stuck with different price ranges per category in that market place.

--Alex

On Sun, Jan 19, 2014 at 2:34 AM, Hariharan Vadivelu hariinfo@gmail.comwrote:

I have been experimenting with the new aggregations feature and I'm
wondering if this use case is possible
Sample gist and Sample Query is available here.
https://gist.github.com/hariinfo/8487083

This will generate Sample Price Facet in the UI
Price
0 - 5 (1)
5 - 10 (2)
10 - 20 (1)
20 - 30 (2)

As you can see I'm defining the price range in the query, this is more or
less static or in other words when I query for a products in a category I
should know the start, end and gap for price in a given category to
generate meaningful price ranges.

Question:

How do I set up a facet which takes into account the actual values of

the prices field (min, max from search context) and sets up ranges
dynamically, may be based on some rules?.

This turns out to be a typical use case for ecommerce domain, where in

my products in a category may have dynamic range and I don't know start,end
or gap.

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/d8514ed4-9e0c-4b0a-8ae9-1db637dde841%40googlegroups.com
.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAGCwEM-meEMrgGjM1GiHYvHWXuntAH5cwiVgMeZQx_u%3DB2T%3DBA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Ivan Brusic) #3

We use a slightly inefficient technique that uses numerous buckets with
static ranges based on previously monitored heuristics and then combine the
buckets on the client side. The ranges change as you apply facets and drill
down into the documents further and the ranges change.

Cheers,

Ivan

On Mon, Jan 20, 2014 at 1:50 AM, Alexander Reelsen alr@spinscale.de wrote:

Hey,

you cannot do this at the moment. And let me explain briefly why I think
it is a bad idea (as it is very use-case dependent).

First having such buckets requires to run over all documents for every
query and find the lowest, highest and average price (oh, which one btw,
average, median, anything else?), as new documents might have been added in
the meantime.

How useful are those buckets? If you have one product, which is
extraordinary expensive (that bugatti in your car list), suddenly all your
buckets will based on that max value. Yes, you could smoothe it, adding
more calculations. Same goes of course for the lowest. Selling only BMWs
and have that one wrong replacement tire in your result list, will give you
a problem. If you have data, which is indexed by users, this will be hard.

Yes, most of this is solvable by algorithms, but you still want to be fast.

At a former company we tried to implement dynamic buckets, and we failed
horribly (not in terms of the result, but in terms of the user experience).
We stuck with different price ranges per category in that market place.

--Alex

On Sun, Jan 19, 2014 at 2:34 AM, Hariharan Vadivelu hariinfo@gmail.comwrote:

I have been experimenting with the new aggregations feature and I'm
wondering if this use case is possible
Sample gist and Sample Query is available here.
https://gist.github.com/hariinfo/8487083

This will generate Sample Price Facet in the UI
Price
0 - 5 (1)
5 - 10 (2)
10 - 20 (1)
20 - 30 (2)

As you can see I'm defining the price range in the query, this is more or
less static or in other words when I query for a products in a category I
should know the start, end and gap for price in a given category to
generate meaningful price ranges.

Question:

How do I set up a facet which takes into account the actual values of

the prices field (min, max from search context) and sets up ranges
dynamically, may be based on some rules?.

This turns out to be a typical use case for ecommerce domain, where in

my products in a category may have dynamic range and I don't know start,end
or gap.

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/d8514ed4-9e0c-4b0a-8ae9-1db637dde841%40googlegroups.com
.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/CAGCwEM-meEMrgGjM1GiHYvHWXuntAH5cwiVgMeZQx_u%3DB2T%3DBA%40mail.gmail.com
.

For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQDwVF5BLy37kx9cKFLyqM41GB88U4TTEkM%2BA8p6Bj9u%2BQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #4