Use some of the problems elasticsearch need to pay attention in python

1, py es client is using http, java api use is tcp

2, es.scroll () method at the time of the query multiple indexes will be reported:

elasticsearch.exceptions.RequestError: RequestError(400, u'too_long_frame_exception', u'An HTTP line is larger than 4096 bytes.')

Because when multiple indexes, _scroll_id will be very long, more than 4096, 4096 is the default http request the maximum, so when requested, the server will complain.

Down with the code, the code change it:

Originally

page = es.scroll(scroll_id=sid, scroll='2m', request_timeout=30)

Changed

es.transport.send_get_body_as = 'POST'

page = es.scroll(body={'scroll': '2m', 'scroll_id': sid},
request_timeout=30)


python library code is as follows:

image

Guess you like

Origin www.cnblogs.com/zbw911/p/11089171.html