当前位置: 首页 > news >正文

厦门网站建设设百家号关键词排名优化

厦门网站建设设,百家号关键词排名优化,wap 网站 源码,自己做网站百度能收录码在Elasticsearch中,Parent Aggregation是一种特殊的单桶聚合,用于选择具有指定类型的父文档,这些类型是通过一个join字段定义的。以下是关于Parent Aggregation的详细介绍: 1.基本概念 Parent Aggregation是一种聚合操作&#x…

在Elasticsearch中,`Parent Aggregation`是一种特殊的单桶聚合,用于选择具有指定类型的父文档,这些类型是通过一个`join`字段定义的。以下是关于`Parent Aggregation`的详细介绍:

1.基本概念

`Parent Aggregation`是一种聚合操作,主要用于处理父-子关系的文档。通过这种聚合,可以将子文档的聚合结果映射到父文档上,从而实现跨文档类型的聚合。

2.应用场景

假设有一个索引,其中包含问题(`question`)和答案(`answer`)两种类型的文档。`answer`文档通过`join`字段与`question`文档关联。通过`Parent Aggregation`,可以将答案的聚合结果(如答案的数量、答案的作者等)映射到问题文档上。

3.配置方法

在使用`Parent Aggregation`时,需要指定以下内容:

• `type`:指定子文档的类型。例如,在问题和答案的场景中,`type`应设置为`answer`。

• 子聚合:可以在`Parent Aggregation`中嵌套其他聚合操作,例如`terms`、`avg`等。

4.示例

以下是一个具体的例子,展示如何使用`Parent Aggregation`将答案的作者聚合到问题的标签上:

索引映射

```json

PUT parent_example

{

  "mappings": {

    "properties": {

      "join": {

        "type": "join",

        "relations": {

          "question": "answer"

        }

      }

    }

  }

}

```

索引文档

```json

PUT parent_example/_doc/1

{

  "join": {

    "name": "question"

  },

  "body": "I have Windows 2003 server and i bought a new Windows 2008 server...",

  "title": "Whats the best way to file transfer my site from server to a newer one?",

  "tags": [

    "windows-server-2003",

    "windows-server-2008",

    "file-transfer"

  ]

}

 

PUT parent_example/_doc/2?routing=1

{

  "join": {

    "name": "answer",

    "parent": "1"

  },

  "owner": {

    "location": "Norfolk, United Kingdom",

    "display_name": "Sam",

    "id": 48

  },

  "body": "Unfortunately you're pretty much limited to FTP...",

  "creation_date": "2009-05-04T13:45:37.030"

}

```

查询

```json

POST parent_example/_search?size=0

{

  "aggs": {

    "top-names": {

      "terms": {

        "field": "owner.display_name.keyword",

        "size": 10

      },

      "aggs": {

        "to-questions": {

          "parent": {

            "type": "answer"

          },

          "aggs": {

            "top-tags": {

              "terms": {

                "field": "tags.keyword",

                "size": 10

              }

            }

          }

        }

      }

    }

  }

}

```

响应

```json

{

  "aggregations": {

    "top-names": {

      "buckets": [

        {

          "key": "Sam",

          "doc_count": 1,

          "to-questions": {

            "doc_count": 1,

            "top-tags": {

              "buckets": [

                {

                  "key": "file-transfer",

                  "doc_count": 1

                },

                {

                  "key": "windows-server-2003",

                  "doc_count": 1

                },

                {

                  "key": "windows-server-2008",

                  "doc_count": 1

                }

              ]

            }

          }

        }

      ]

    }

  }

}

```

5.注意事项

• `Parent Aggregation`依赖于`join`字段来定义父-子关系。

• 子聚合可以是任意类型的聚合操作,但必须与父文档的类型兼容。

通过`Parent Aggregation`,可以有效地将子文档的聚合结果映射到父文档上,从而实现复杂的跨文档类型的聚合操作。

http://www.mmbaike.com/news/51714.html

相关文章:

  • 云南红舰工贸有限公司的网站建设网络营销策略分析论文
  • 学校网站开发价格音乐接单推广app平台
  • 美术教育机构网站建设方案网推项目
  • 鹤壁专业做网站公司今日的新闻头条10条
  • 上海网站建设高端编程培训机构加盟哪家好
  • 一 建设茶叶网站前的市场分析优化公司网站排名
  • 如何上传织梦做的网站下载百度app最新版到桌面
  • 宫廷计有哪些网站开发的江小白网络营销案例
  • 做网站添加mp3如何推广自己的店铺?
  • 做外贸找客户的网站福州关键词搜索排名
  • 河北省招投标信息网网络优化推广公司哪家好
  • 网站开发背景400字淘宝网店运营
  • 物业公司网站模板百度指数官网查询入口
  • 石家庄网站开发公司竞价排名点击
  • 专业做公司网站的机构seo课程培训要多少钱
  • 网站做直播需要办理什么证淘宝权重查询
  • 网站建设搜索网络营销与网站推广的
  • 北京做电商网站微信公众号小程序怎么做
  • 商务网站开发意义一个品牌的策划方案
  • 绵阳模板网站hao123网址大全浏览器设为主页
  • 筹建网站信息技术郑州做网站的专业公司
  • 领卷网站怎么做的谷歌独立站
  • 做做网站需要多少钱企业网页制作
  • 入侵织梦网站后台拉新十大推广app平台
  • 住房和城乡建设网站网店运营培训
  • 郑州网站优化工资推广下载
  • 免费网站java源重庆做网络优化公司电话
  • 网站建设市场占有率东莞seo优化推广
  • wordpress 会话已过期郑州seo公司哪家好
  • 专业网站建设技术十大室内设计网站