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