AWS Elasticsearch:搜索时出现“ too_many_clauses”异常

问题描述

我对Elasticsearch功能非常陌生。我使用AWS Elasticsearch + Kibana。对于某些查询,我会收到一个例外:

ElasticsearchClientException: Request Failed to execute. 
Call: Status code 500 from: POST /my-data/_search?pretty=true&error_trace=true&typed_keys=true. 
ServerError: Type: search_phase_execution_exception Reason: "all shards Failed" 
CausedBy: "Type: too_many_clauses Reason: "maxClauseCount is set to 1024"

我已经使用一种将maxClauseCount设置为更大的数量解决方案复习了该主题,但是该选项在AWS ES中不可用。有人可以帮助我更新AWS ES设置以解决此问题或查看我的nesT请求(我读过一个选项,认为错误的请求是导致此异常的原因)。

这是我的nesT请求:

{
"aggs": {
    "contentType": {
        "terms": {
            "field": "contentType"
        }
    }
},"from": 0,"query": {
    "bool": {
        "must": [
            {
                "terms": {
                    "specialty": [
                        100,1
                    ]
                }
            },{
                "bool": {
                    "should": [
                        {
                            "bool": {
                                "must": [
                                    {
                                        "exists": {
                                            "field": "isBlocked"
                                        }
                                    },{
                                        "term": {
                                            "isBlocked": {
                                                "value": false
                                            }
                                        }
                                    }
                                ]
                            }
                        },{
                            "bool": {
                                "must_not": [
                                    {
                                        "exists": {
                                            "field": "isBlocked"
                                        }
                                    }
                                ]
                            }
                        }
                    ]
                }
            },{
                "terms": {
                    "contentType": [
                        "1","2","5","6","7","15","60","50","52"
                    ]
                }
            },{
                "query_string": {
                    "auto_generate_synonyms_phrase_query": true,"default_operator": "and","fields": [
                        "title^7","description^5","contentId^7","pMID^7"
                    ],"query": "*han*","rewrite": "scoring_boolean","type": "most_fields"
                }
            }
        ]
    }
},"size": 50,"sort": [
    {
        "_script": {
            "script": {
                "source": "def contentImportanceFactor = 1; if (doc['contentType'].value == 1) { contentImportanceFactor = 1.5; } else if (doc['contentType'].value == 7) { contentImportanceFactor = 0.3; } return _score*contentImportanceFactor;"
            },"type": "number","order": "desc"
        }
    }
],"track_scores": true
}

预先感谢

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...