How to organize related types

Hi,

I'm building a simple blog for myself as a way to learn ES. I have a pretty
typical set of models, Post, PostTag, PostCategory, PostComment etc.. I'm
wondering what the best way to store/index these models is -- specifically,
with documents that are related to other types. Does ES handle sql-like
joins with related documents? For example, would Comments be a separate
type, or would they be nested within the Post from which they belong?

Apologies for the n00bness.

Matt

IMO, I would think about what document type I want to search for.

Are you looking for Posts ? Comments ? I think that your need is to find posts and only that.

So, I would only index posts with all its fields (categories, comments, ...)
Each Time a new comment is added, just push again the full post to ES.

That's the way I will do it.

BTW it's difficult to stop thinking SQL in a NOSQL world. Things are differents and we don't need to split datas into relationnal documents.

David :wink:

Le 24 sept. 2011 à 02:51, goodieboy goodieboy@gmail.com a écrit :

Hi,

I'm building a simple blog for myself as a way to learn ES. I have a pretty typical set of models, Post, PostTag, PostCategory, PostComment etc.. I'm wondering what the best way to store/index these models is -- specifically, with documents that are related to other types. Does ES handle sql-like joins with related documents? For example, would Comments be a separate type, or would they be nested within the Post from which they belong?

Apologies for the n00bness.

Matt

Thanks! That's very helpful.

One thing I'm not clear on how to do is hierarchical relationships. I want
to store the comments for a post in the post document. A comment can have a
parent etc... What would a mapping look like to handle this situation? What
if I wanted to query posts on a particular comment author name?

Thanks,
Matt