如何检索父子关系断开的文档>?



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

索引在文档之间使用父>子关系。是否有一种方法来检索具有无效父(父id引用已删除的文档)的子列表?

您可能可以使用以下行查询来获取孤儿文档列表

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

最新更新