You don’t need one shard per user unless each user has a very big amount of data.
Using routing is good as all documents for a given user will go to the same shard. But also documents from other users will go to that shard.
That’s not an issue. Use filters to filter your user data based on their login/id/whatever.
The cool thing you could do then is to use aliases. Create one alias per user and set within this alias the routing key AND the filter.
Then just query the alias instead of the index name and you’re done.
If a new user come, just add the new alias and index its data. It will go to whichever shard. You don’t really need to worry about it.
Then another question might be « how many shard I will need » and the answer is it depends but I would say: try to keep it as minimal as possible.
Make sense?
--
David Pilato - Developer | Evangelist
elastic.co
@dadoonet https://twitter.com/dadoonet | @elasticsearchfr https://twitter.com/elasticsearchfr | @scrutmydocs https://twitter.com/scrutmydocs
Le 23 avr. 2015 à 09:30, Zaid Amir redserpent7@gmail.com a écrit :
Hi,
I am trying to figure out the best way to design my ES cluster. Currently my search service is subscription based and each user can only search his own data.
So looking around I found several examples about users data flow and the way of using aliases and its all straight forward.
One thing that I am struggling to understand is the routing setup. Now lets assume that I started an index named "accounts" with 100 primary shards and 1 replica. Now users started subscribing so I start creating an alias per user and routing each alias to a specific shard (1, 2, 3, ..., 100).
No if 100 users have already subscribed and a new user comes along, can I route the new user to the first shard? Or should I start another index for the next 100 users?
My concern with this also is performance. Lets say that both nodes are running on a Quad core CPU with 32 GB of ram? Is there a good indicator of how many shards I should allocate per index assuming that each document is around 512KB in size?
--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com mailto:elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/8338a395-6143-4899-bc9e-6145399cc4a4%40googlegroups.com https://groups.google.com/d/msgid/elasticsearch/8338a395-6143-4899-bc9e-6145399cc4a4%40googlegroups.com?utm_medium=email&utm_source=footer.
For more options, visit https://groups.google.com/d/optout https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/AF4B3B13-E15C-447F-AB2E-0A4DB22EE0F6%40pilato.fr.
For more options, visit https://groups.google.com/d/optout.