Search on an associated type


(Keith Webster) #1

I was wondering if the following is possible:

I have 2 different types in my index, product and product category. A
product can have many categories so I'm storing an array of category ids in
the product.

If when searching for a product on it's fields (say description,
manufacturer etc) how would I also search on the assigned category
descriptions? Is this even possible?

--


(David Pilato) #2

You can have a look at parent child or nested features.
But, i'm not a great fan of it.

If you can, I recommand to store in your product type all what you know about the product category. IMHO, It will duplicates data but will give the best response time.

So, don't store ids but directly contents.

If it doesn't fit to your use case, try nested or parent/child.

HTH

David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 23 août 2012 à 00:24, ciatog keith.webster@gmail.com a écrit :

I was wondering if the following is possible:

I have 2 different types in my index, product and product category. A product can have many categories so I'm storing an array of category ids in the product.

If when searching for a product on it's fields (say description, manufacturer etc) how would I also search on the assigned category descriptions? Is this even possible?

--


(system) #3