Elastic Search Design question

Hi, I am trying to figure out how to best model my data in elasticsearch
for the following scenario.

Imagine a chat service which can have a number of participants (in tens of
thousands). Messages are not pushed out to members but rather members can
query for new messages based on which messages they have received so far.
So we need to keep track of the last message sent to the channel and also
the last message which each member has received. This comparison will
allow us to determine if there are any new messages for this member.

The frequency of messages being sent is high (which may require frequent
re-indexing and replica updates). I would also like to avoid double read
i.e. read last message time from chat and then make another query

Possible models:

  1. Nested objects. (Concern: is only root document is returned and not
    nested objects? Performance of re-indexing based on high frequency of
    udpates? Large replica updates between elastic search nodes).

  2. Parent Child. (Would like to know more about this).

  3. Sort of parent child without linking the documents with the '_parent'
    property. So each member will keep track of both the last message sent to
    the chat as well as the last message they have seen so far. (Concern: a
    single message sent to a chat will required tens of thousands of updates to
    all its members).

  4. A single large document with individual members nested inside.
    (Concern: The size of the document and frequency of updates will thrash
    the system?)

I would like to understand how elasticsearch can best model the above
scenario or even if it is the right tool for this problem.


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/e7850f0a-25d3-4fd0-8595-a33ec38485d8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.