【问题标题】:How to retrieve documents with a broken parent->child relationship?如何检索父->子关系中断的文档?
【发布时间】:2015-09-25 22:13:28
【问题描述】:

我目前正在编写脚本来管理 Elasticsearch 集群并确保数据完整性。

索引使用文档之间的父>子关系。有没有办法检索无效父母的孩子列表(父母 id 引用已删除的文档)?

【问题讨论】:

    标签: elasticsearch


    【解决方案1】:

    您可能可以在以下几行中使用查询来获取孤立子文档的列表

    POST /<index_name>/<child_type>/_search
    {
       "filter": {
          "not": {
             "has_parent": {
                "parent_type": "<parent_type>",
                 "query": {
                    "match_all": {}
                 }
             }
          }
       }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-03-19
      • 1970-01-01
      • 2015-01-02
      • 1970-01-01
      • 2017-01-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多