1, py es client 使用是 http ,java api 使用是 tcp
2, es.scroll() 方法 在查詢多個索引的時候會報 :
elasticsearch.exceptions.RequestError: RequestError(400, u'too_long_frame_exception', u'An HTTP line is larger than 4096 bytes.')
因為多個索引的時候 , _scroll_id 會很長,超過4096, 4096 是 http請求中默認的最大值,所以在請求的時候, 服務端會報錯。
向下跟代碼,把代碼改一下:
原來是
page = es.scroll(scroll_id=sid, scroll='2m', request_timeout=30)
改為
es.transport.send_get_body_as = 'POST'page = es.scroll(body={'scroll': '2m', 'scroll_id': sid},
request_timeout=30)
python 庫中代碼如下: