Hi, i am developing one messaging kind of app in which there could be N groups and each group can have N messages and i am thinking of storing message as document in couchbase.
For that i am using one collections for that, called as “messages” and in which have we could have messages like,
doc key → msg/1
doc value → {
“msg” : “couchbase is Great”,
“groupId” :“group1”
}
doc key → msg/2
doc value → {
“msg” : “elasticsearch is great”,
“groupId” :“group2”
}
Now I want to provide search on group. So i was thinking to use type mapping on search index.
So type field will be “groupId” and in while creating search index i am specifying “messages.group1”. So it will be create search index for type group1 only.
So if i search on group1 with keyword “great” then it returns me msg with “msg1” only.
So here my question is that, is it good design that to create separate search index per group. Because in our system there could be more than 1 million groups. So there would be 1 million search index in system.
If i create one search index per collection, then for example “Hi” text could be found in multiple messages across multiple groups. So internally it would have long doc Id set against “Hi” keyword and it might affect the query result.
So what would be better design to solve this kind of scenario.
Thanks in advance.