Best approch of Elastic Search time based feeds module? Best approch of Elastic Search time based feeds module? elasticsearch elasticsearch

Best approch of Elastic Search time based feeds module?


Performance

  • Parent/child stores relevant data in same shards, as separately doc, which avoid the network;
  • Parent/child needs a joining process when retrieving data;
  • Nested object store the inner and outer object together, as a single doc;

So, we can infer:

  • Update nested object will re-index whole index, which can very expensive if your document is large;
  • Update parent or child alone will not affect the other one;
  • Searching nested object is a little fast, which save the process of joining;

Suggestions

As far as I understand your problem, you should use parent/child.

  • When your group's comments become more and more, adding a new comment will still re-index whole content, which can be very time-consuming;
  • On the other hand, search a comment with parent/child just need one more look up after finding the child, which is relative acceptable.

Furthermore, you should also take the rate of searching a comment comparing to adding a comment into account:

  • If you need searching a lot but a little new comments, maybe you can choose nested object;
  • Otherwise, choose parent/child;

By the way, you may combine both of them:

  • When this feed is active, use parent/child to store them;
  • When it is closed, i.e., no more comments can be added, move them to a new index with nested object;


If you do not specify more detailed info other than very frequently it is going to be hard to come up with a recommendation. Also you have not mentioned how your data looks like. A comment in a blog post might be happening rare, even in heated discussions. A comment/reply in a forum post (that will result in a huge document) might be sth very different. I'd personally start with nested and see how it goes, but I also do not know all the requirements, so this might be a very wrong answer.