Best approch of Elastic Search time based feeds module?

Viewed 126

I am new with elastic search and looking for the best solution with which i can create a feed module which have time based feeds along with there group and comment.

I learned little and come up with following.

PUT /group
    {
      "mappings": {
        "groupDetail": {},
        "content": {
          "_parent": {
            "type": "groupDetail" 
          }
        },
        "comment": {
          "_parent": {
            "type": "content" 
          }
        }
      }
    }

so that will be placed separately as per index.

but than after i found one post where i found that parent child is costly operation for search than nested objects.

something like following is two group(feed) having details with content and comments as nested element.

{
  "_index": "group",
  "_type": "groupDetail",
  "_id": 6829,
  "_score": 1,
  "_source": {
    "groupid": 6829,
    "name": "Jignesh Public",
    "insdate": "2016-10-01T04:09:33.916Z",
    "upddate": "2017-04-19T05:19:40.281Z",
    "isVerified": true,
    "tags": [
      "spotrs",
      "surat"
    ],
    "content": [
      {
        "contentid": 1,
        "type": "1",
        "byUser": 5858,
        "insdate": "2016-10-01 11:20",
        "info": [
          {
            "t": 1,
            "v": "lorem ipsum long text 1"
          },
          {
            "t": 2,
            "v": "http://www.imageurl.com/1"
          }
        ],
        "comments": [
          {
            "byuser": 5859,
            "comment": "Comment 1",
            "upddate": "2016-10-01T04:09:33.916Z"
          },
          {
            "byuser": 5860,
            "comment": "Comment 2",
            "upddate": "2016-10-01T04:09:33.916Z"
          }
        ]
      },
      {
        "contentid": 2,
        "type": "2",
        "byUser": 5859,
        "insdate": "2016-10-01 11:20",
        "info": [
          {
            "t": 4,
            "v": "http://www.videoURL.com/1"
          }
        ],
        "comments": [
          {
            "byuser": 5859,
            "comment": "Comment 1",
            "upddate": "2016-10-01T04:09:33.916Z"
          },
          {
            "byuser": 5860,
            "comment": "Comment 2",
            "upddate": "2016-10-01T04:09:33.916Z"
          }
        ]
      }
    ]
  }
}

{
  "_index": "group",
  "_type": "groupDetail",
  "_id": 6849,
  "_score": 1,
  "_source": {
    "groupid": 6849,
    "name": "Xyz Group Public",
    "insdate": "2016-10-01T04:09:33.916Z",
    "upddate": "2017-04-19T05:19:40.281Z",
    "isVerified": false,
    "tags": [
      "spotrs",
      "food"
    ],
    "content": [
      {
        "contentid": 3,
        "type": "1",
        "byUser": 5858,
        "insdate": "2016-10-01 11:20",
        "info": [
          {
            "t": 1,
            "v": "lorem ipsum long text 3"
          },
          {
            "t": 2,
            "v": "http://www.imageurl.com/1"
          }
        ],
        "comments": [
          {
            "byuser": 5859,
            "comment": "Comment 1",
            "upddate": "2016-10-01T04:09:33.916Z"
          },
          {
            "byuser": 5860,
            "comment": "Comment 2",
            "upddate": "2016-10-01T04:09:33.916Z"
          }
        ]
      },
      {
        "contentid": 4,
        "type": "2",
        "byUser": 5859,
        "insdate": "2016-10-01 11:20",
        "info": [
          {
            "t": 4,
            "v": "http://www.videoURL.com/1"
          }
        ],
        "comments": [
          {
            "byuser": 5859,
            "comment": "Comment 1",
            "upddate": "2016-10-01T04:09:33.916Z"
          },
          {
            "byuser": 5860,
            "comment": "Comment 2",
            "upddate": "2016-10-01T04:09:33.916Z"
          }
        ]
      }
    ]
  }
}

now if i try to think with nested object than i confused if user add comment very frequently than reindexing factor will effect?

So main think i want to ask is which is the best approach with which i can add comment frequently and my content searching result is also faster.

2 Answers
Related