# ES indexing and scaling question

**URL:** <https://discuss.elastic.co/t/es-indexing-and-scaling-question/8791>\
**Category:** Elasticsearch\
**Created:** [August 20, 2012, 3:33pm UTC](https://discuss.elastic.co/t/es-indexing-and-scaling-question/8791 "2012-08-20T15:33:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![msya](https://avatars.discourse-cdn.com/v4/letter/m/5f9b8f/32.png) [@msya](https://discuss.elastic.co/u/msya)\
**Post date:** [August 20, 2012, 3:33pm UTC](https://discuss.elastic.co/t/es-indexing-and-scaling-question/8791/1 "2012-08-20T15:33:58Z")

</div>

In my web app, there are various communities. These communities have groups  
and the groups contain posts. A user could view posts in groups that he or  
she is a member of. When a user searches for a post, they will be able to  
provide a keyword, group id, user id, posted after date, and the number of  
queries they want returned. So, I want to index the information in such a  
way that it is scalable and the queries are faster.

This is how I am currently indexing information:

\_index: community\_id\_113  
\_type: question  
group\_id : 150  
post\_date : 2012-8-1T15:12:25  
message : "Hello. How are you?"  
attachment : null

For each community, I am creating an index. I am indexing a question or  
reply into the community index with a question or reply type.

If a user just enters a keyword, the search should be in groups that the  
user is a member of. So, this is my query for it:

curl 'localhost:9200/community\_id\_113/question/\_search?pretty=true' -d '  
{  
"query": {  
"filtered": {  
"query": {  
"queryString": {  
"default\_field": "message",  
"query": "hello"  
}  
},  
"filter": {  
"bool": {  
"should": [  
{  
"term": {  
"group\_id": "150"  
}  
},  
{  
"term": {  
"group\_id": "151"  
}  
}  
],  
"must": {  
"numeric\_range": {  
"post\_date": {  
"from": "2009-01-01",  
"to": "2012-09-01"  
}  
}  
}  
}  
}  
}  
}  
}'

In the should clause, I am going to have all the group\_ids that the user is  
member of. So, the example above has only 2 group\_ids, but there will be  
many more. Will that query be slow if there are many group ids?

--

---

<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:15am UTC](https://discuss.elastic.co/t/es-indexing-and-scaling-question/8791/2 "2017-07-06T03:15:45Z")

</div>

Closed on July 6, 2017, 3:15am UTC


