elasticsearch - 可以在elasticsearch has_child查询中使用max_children为0吗?

标签 elasticsearch

我希望能够选择没有任何符合特定条件的 child 的 parent 。我以为如果这样做:

        {
          "has_child": {
            "max_children": 0,
            "type": "event",
            "filter": {
              "bool": {
                "must": [
                  {
                    "bool": {
                      "must": [
                        {
                          "term": {
                            "cs_e": "eventF"
                          }
                        }
                      ],
                      "should": [],
                      "mustNot": []
                    }
                  }
                ],
                "should": [],
                "mustNot": []
              }
            }
          }
        }

那么这将使我返回最多有0个 child 的 parent -即不匹配的 parent 。但是,奇怪的是,我确实从查询中返回了一个父级,并且那个父级有一个匹配的子级。

这是预期的吗? (可能是我在某个地方搞砸了或被误解了)?

非常感谢!

最佳答案

在“ES 5.0的重大变化”中找到了以下引用:

https://www.elastic.co/guide/en/elasticsearch/reference/current/breaking_50_search_changes.html

When the max_children parameter was set to 0 on the has_child query then there was no upper limit on how many child documents were allowed to match. Now, 0 really means that zero child documents are allowed. If no upper limit is needed then the max_children parameter shouldn’t be specified at all.



因此在ES> 5.0中应该可以使用,但是由于某些原因,max_children = 0在5.3.0中实际上不起作用

关于elasticsearch - 可以在elasticsearch has_child查询中使用max_children为0吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34497722/

相关文章:

elasticsearch - TypeError: 'IndicesClient'对象不可调用

elasticsearch - ES_dsl.Q()中 “path”的功能是什么?

elasticsearch - Helm chart 稳定/logstash-在同一ns中看不到elasticsearch

elasticsearch - Logstash Kafka主题作为Elasticsearch索引名的一部分

Elasticsearch 更喜欢这个查询

java - Elasticsearch java API : how to define fields as you would with _source:[] in dsl

elasticsearch - elasticsearch ttl强制删除旧消息

javascript - 使用 body 执行 Get 请求 - Node js

elasticsearch - 如何让 Elasticsearch 忽略 char_filter 清空的术语?

amazon-web-services - Amazon AWS Elasticsearch安装插件和文件