python操作es處理超過10000條數據報錯查詢不到


報錯信息如下

elasticsearch.exceptions.TransportError: TransportError(500, 'search_phase_execution_exception', 'Result window is too large, from + size must be less than or equal to

 

解決辦法:

在創建索引的時候添加:

mappings = {
    "mappings": {
        "numerical_keyword": {
            "properties": {
                "search_keyword": {  # 搜索關鍵詞
                    "type": "text",
                    "index": "true"
                }
            }
        }
    },
    "settings": {
        "index": {
            "max_result_window": 500000  # 數量限制,可以自己定義
                }
            }
}

這個辦法可以完美解決


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM