在es_client文件中的search_documents方法中,这个是输出response结构应该是这种
{ "took": 5, "timed_out": false, "_shards": { "total": 1, "successful": 1, "skipped": 0, "failed": 0 }, "hits": { "total": { "value": 20, "relation": "eq" }, "max_score": 1.3862942, "hits": [ { "_index": "my-index-000001", "_type" : "_doc", "_id": "0", "_score": 1.3862942, "_source": { "@timestamp": "2099-11-15T14:12:12", "http": { "request": { "method": "get" }, "response": { "status_code": 200, "bytes": 1070000 }, "version": "1.1" }, "source": { "ip": "127.0.0.1" }, "message": "GET /search HTTP/1.1 200 1070000", "user": { "id": "kimchy" } } }, ... ] } }
,遍历的时候应该是使用错了变量吧,应该是response['hits'] ['hits']吧

在es_client文件中的search_documents方法中,这个是输出response结构应该是这种
{ "took": 5, "timed_out": false, "_shards": { "total": 1, "successful": 1, "skipped": 0, "failed": 0 }, "hits": { "total": { "value": 20, "relation": "eq" }, "max_score": 1.3862942, "hits": [ { "_index": "my-index-000001", "_type" : "_doc", "_id": "0", "_score": 1.3862942, "_source": { "@timestamp": "2099-11-15T14:12:12", "http": { "request": { "method": "get" }, "response": { "status_code": 200, "bytes": 1070000 }, "version": "1.1" }, "source": { "ip": "127.0.0.1" }, "message": "GET /search HTTP/1.1 200 1070000", "user": { "id": "kimchy" } } }, ... ] } },遍历的时候应该是使用错了变量吧,应该是response['hits'] ['hits']吧