查询中的ElasticSearch max子句计数

时间:2018-08-23 13:28:38

标签: elasticsearch elastic-stack

我的子句计数超过了设置为 1024 indices.query.bool.max_clause_count ,由于某些原因,我无法增加此计数环境限制。请在查询中建议进行一些重写,以免在增加子句时不会发生

{
    "size": "5",
    "query": {
        "constant_score" : { 
        "filter" : {
        "bool": {
            "must": [{
                    "nested": {
                        "path": "phone",
                        "query": {
                            "bool": {
                                "should": [{
                                        "bool": {
                                            "must": [{
                                                    "match": {
                                                        "phone.areaCode": "45"
                                                    }
                                                }, {
                                                    "match": {
                                                        "phone.countryCode": "12"
                                                    }
                                                }, {
                                                    "match": {
                                                        "phone.extension": "123"
                                                    }
                                                }, {
                                                    "match": {
                                                        "phone.phoneNo": "8287251513"
                                                    }
                                                }
                                            ]
                                        }
                                    },{
                                        "bool": {
                                            "must": [{
                                                    "match": {
                                                        "phone.areaCode": "45"
                                                    }
                                                }, {
                                                    "match": {
                                                        "phone.countryCode": "12"
                                                    }
                                                }, {
                                                    "match": {
                                                        "phone.extension": "123"
                                                    }
                                                }, {
                                                    "match": {
                                                        "phone.phoneNo": "8287251513"
                                                    }
                                                }
                                            ]
                                        }
                                    }
                                ]
                            }
                        },
                        "inner_hits": {
                            "size": "10000"
                        }
                    }
                }
            ]
        }
        }
        }
    },
    "from": 0
}

should子句中的每个电话号码都有一个新条目,超过了我获得多个号码时的限制。

0 个答案:

没有答案