Upstream prematurely closed connection while reading response header from upstream - ES/kibana

hello all

my setup is as such:

nginx(*:443) -> kibana(127.0.0.1:5601) -> elasticsearch (127.0.0.1:5106)

using kibana with elasticsearch for anything under 3 days timestamp is perfect and it runs smoothly; though if i seek back longer it gives me a gateway timeout...
in nginx error log i see "upstream prematurely closed connection while reading response header from upstream"

1852#0: *200 upstream prematurely closed connection while reading response header from upstream, client: X.X.X.X, server: kibana.interface.fake, request: "POST /elasticsearch/_msearch?timeout=0&ignore_unavailable=true&preference=1437744706387 HTTP/1.1", upstream: "http://127.0.0.1:5601/elasticsearch/_msearch?timeout=0&ignore_unavailable=true&preference=1437744706387", host: "kibana.interface.fake", referrer: "https://kibana.interface.fake/"

i don't have a problem in waiting for any time it takes to show me the output so i increased every proxy_read and proxy_send as well as header timeout i know of in nginx; and that is still causing a gateway timeout when query takes longer to execute...
server has good specs though internet bandwidth on client side is a bit slow so it may take a while to retrieve all data and visualize them...

any advice on how to fix this ?

Maybe try increasing the timeout on nginx's side.