基于弹性搜索时间的Feed模块的最佳应用程序?

Par*_*t0z 10 performance timeline feeds elasticsearch

我是弹性搜索的新手,并寻找最佳解决方案,我可以创建一个饲料模块,其中包含基于时间的饲料以及组和评论.

我学到的很少,并且想出了以下内容.

PUT /group
    {
      "mappings": {
        "groupDetail": {},
        "content": {
          "_parent": {
            "type": "groupDetail" 
          }
        },
        "comment": {
          "_parent": {
            "type": "content" 
          }
        }
      }
    }
Run Code Online (Sandbox Code Playgroud)

因此将根据索引单独放置.

但是,在我找到一个帖子后,我发现父母的搜索操作比嵌套对象昂贵.

类似下面的内容是两个组(feed),其中包含内容和注释的详细信息作为嵌套元素.

{
  "_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"
          }
        ]
      }
    ]
  }
}
Run Code Online (Sandbox Code Playgroud)

现在如果我试着用嵌套对象思考比我困惑如果用户非常频繁地添加评论比重新索引因素会影响?

所以主要想想我想问的是哪种方法可以经常添加评论,我的内容搜索结果也更快.

alr*_*alr 2

如果您不指定更详细的信息,则very frequently很难提出建议。此外,您还没有提到您的数据是什么样子。即使在激烈的讨论中,博客文章中的评论也可能很少发生。论坛帖子中的评论/回复(这将产生一个巨大的文档)可能会非常不同。我个人会从嵌套开始,看看它是如何进行的,但我也不知道所有的要求,所以这可能是一个非常错误的答案。