Adding comment data with Elasticsearch aggregation

The blog has been added to the system. Now a user can add a comment. So next, we will see how to add a comment. As discussed, the Comment document type is defined as a nested type in the blog document. It means the blog document contains an array of comment objects, making a one-to-many relationship. We also need to create a comment model class as follows:

public class Comment {  private String id;  private String blogId;  private String parentId;  private int childSequence;  private String position;  private String status;  private int level;  private String user;  private String emailAddress;  private String commentText;    @JsonFormat (shape = JsonFormat.Shape.STRING, pattern = "MM-dd-yyyy'T'HH:mm:ss") ...

Get Spring 5.0 Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.