How to layout indexes


(Douglas Ferguson) #1

I've watched a few of the videos and done some reading but I'm still not
clear on the best way to lay out my indexes.

So, I figured I might present a simple example to see if you guys might
have some insight.

For example, we have a User object and an Organization object.
A user may be in multiple Organizations.

I need to be able to search for Organizations using the fields from the
user object.

One method I see of doing this is to "denormalize" the data where the
Organization would have an array of users "objects" containing the fields
you need to search on.
The problem of course is that you need to index all the Organizations for
that user whenever the User changes.

I've also seen nested documents and parent/child, but I'm not sure either
of these actually solves this problem.

Any thoughts?

--


(Radu Gheorghe) #2

Hi Douglas,

If you use 0.19.10 you can use has_parent queries to look in the
Organization objects, but get results with User objects:
http://www.elasticsearch.org/guide/reference/query-dsl/has-parent-query.html

Best regards,
Radu

http://sematext.com/ -- ElasticSearch -- Solr -- Lucene

On Wednesday, October 10, 2012 6:26:48 AM UTC+3, Douglas Ferguson wrote:

I've watched a few of the videos and done some reading but I'm still not
clear on the best way to lay out my indexes.

So, I figured I might present a simple example to see if you guys might
have some insight.

For example, we have a User object and an Organization object.
A user may be in multiple Organizations.

I need to be able to search for Organizations using the fields from the
user object.

One method I see of doing this is to "denormalize" the data where the
Organization would have an array of users "objects" containing the fields
you need to search on.
The problem of course is that you need to index all the Organizations for
that user whenever the User changes.

I've also seen nested documents and parent/child, but I'm not sure either
of these actually solves this problem.

Any thoughts?

--


(system) #3