Optimize product/prices parent/child relation


(Alex S.V.) #1

Hi

Help me please to find right solution for next case:

I have products and location prices. So, each product has different price
in different locations (stores).

Simplest query is:

"search products, display minimum price and sort by this price"

Advanced query is:

*"search products within some price range, location region, display minimum
price and sort by this price" *

Here is my mapping (I'm thinking about parent/child schema)
{
product: {
properties: {
title: { type: "string" },
description: { type: "string" },
options: { type: "string" }
}
},
price: {
_parent: { type: "product" },
properties: {
available: { type: "integer" },
price: { type: "float" },
location: { type: "geo_point" },
city: { type: "string" }
}
}
}

One idea is to query products, use top_children in combination with min
score, where score is the price.
But how to optimize it for cases, when product has thousands of prices?

--
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/7a7dae72-cc29-4279-ab6b-6541756c9513%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(system) #2