PHP通过API对ES进行搜索后发现只能获取10条数据,搜索语句如下:
{ "query": { "filtered": { "query": { "query_string": { "query": "level:\"警告\" AND source_name:\"ASP.NET\" ", "analyze_wildcard": true } }, "filter": { "bool": { "must": [ { "range": { "@timestamp": { "gte": 1494309300, "lte": 1494489299, "format": "epoch_second" } } } ], "must_not": [] } } } } }
其余ES如果没有指定SIZE的话,默认是10条
http://elasticsearch-py.readthedocs.io/en/master/api.html#elasticsearch.Elasticsearch.search
但是size也不能超过10000,否则也会报错。
修改搜索语句如下:
{ "size": 10000, "query": { "filtered": { "query": { "query_string": { "query": "level:\"警告\" AND source_name:\"ASP.NET\" ", "analyze_wildcard": true } }, "filter": { "bool": { "must": [ { "range": { "@timestamp": { "gte": 1494309300, "lte": 1494489299, "format": "epoch_second" } } } ], "must_not": [] } } } } }
即可
时间: 2024-10-08 10:17:11