# Usecase suggestion needed

**URL:** <https://discuss.elastic.co/t/usecase-suggestion-needed/6276>\
**Category:** Elasticsearch\
**Created:** [January 3, 2012, 9:22pm UTC](https://discuss.elastic.co/t/usecase-suggestion-needed/6276 "2012-01-03T21:22:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eugene\_Strokin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eugene_strokin/32/1238_2.png) [@Eugene\_Strokin](https://discuss.elastic.co/u/Eugene_Strokin)\
**Post date:** [January 3, 2012, 9:22pm UTC](https://discuss.elastic.co/t/usecase-suggestion-needed/6276/1 "2012-01-03T21:22:10Z")

</div>

I don't have a lot of experience with ES, so forgive if the answer is  
obvious. But I still need help with some usecase:  
I have document structure which is similar to something like blog  
post.  
For sake of example I'll remove some non related fields, and I'd have  
something like this:  
POST:  
ID:String  
Description:Text  
OwnerScreenName: String  
OwnerID:String

I have millions of such posts indexed, and it works Ok.  
Now I need to add Comments for each post. Each Comment would have very  
similar fields:  
COMMENT:  
ID:String  
PostID:String  
Comment:Text  
CommenterScreenName:String

I could have comments be added/edited/deleted relatively often and in  
large numbers (could be from 0 to 300 comments per post in usual case,  
and even a lot more in some special cases). Also I need to find posts  
based on the comment's content.

So my question: Should I just add the comments data right to the post  
(making it part of the document)? But in this case, when I need just  
the posts without comments, I'll still be getting everything together,  
and because it could have a lot of comments, it could be big overhead.  
Or should I keep Comments as a separate type in ES. But in this case,  
to retrieve posts and comments together, I'd need to make 2 calls to  
ES. Also, post's content should boost score higher than comment's  
content, and if the comments are separate documents, I'm not sure how  
to write such queries, if possible at all.

Could you give me some suggestions, or at least direction where to dig  
in?

Thanks in advance,  
Eugene S.

---

<div class="post-metadata">

**Author:** ![Karussell1](https://avatars.discourse-cdn.com/v4/letter/k/50afbb/32.png) [@Karussell1](https://discuss.elastic.co/u/Karussell1)\
**Post date:** [January 4, 2012, 2:13pm UTC](https://discuss.elastic.co/t/usecase-suggestion-needed/6276/2 "2012-01-04T14:13:10Z")

</div>

Have a look into parent/child which should be perfectly for your  
usecase.

> post's content should boost score higher than comment's content

This is easier when separate IMO e.g. using disMaxQuery.

Peter.

On 3 Jan., 22:22, Eugene Strokin [eug...@strokin.info](mailto:eug...@strokin.info) wrote:

> I don't have a lot of experience with ES, so forgive if the answer is  
> obvious. But I still need help with some usecase:  
> I have document structure which is similar to something like blog  
> post.  
> For sake of example I'll remove some non related fields, and I'd have  
> something like this:  
> POST:  
> ID:String  
> Description:Text  
> OwnerScreenName: String  
> OwnerID:String
> 
> I have millions of such posts indexed, and it works Ok.  
> Now I need to add Comments for each post. Each Comment would have very  
> similar fields:  
> COMMENT:  
> ID:String  
> PostID:String  
> Comment:Text  
> CommenterScreenName:String
> 
> I could have comments be added/edited/deleted relatively often and in  
> large numbers (could be from 0 to 300 comments per post in usual case,  
> and even a lot more in some special cases). Also I need to find posts  
> based on the comment's content.
> 
> So my question: Should I just add the comments data right to the post  
> (making it part of the document)? But in this case, when I need just  
> the posts without comments, I'll still be getting everything together,  
> and because it could have a lot of comments, it could be big overhead.  
> Or should I keep Comments as a separate type in ES. But in this case,  
> to retrieve posts and comments together, I'd need to make 2 calls to  
> ES. Also, post's content should boost score higher than comment's  
> content, and if the comments are separate documents, I'm not sure how  
> to write such queries, if possible at all.
> 
> Could you give me some suggestions, or at least direction where to dig  
> in?
> 
> Thanks in advance,  
> Eugene S.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 3:43am UTC](https://discuss.elastic.co/t/usecase-suggestion-needed/6276/3 "2017-07-06T03:43:51Z")

</div>


