# TooLongFrameException: HTTP header is larger than 8192 bytes

**URL:** <https://discuss.elastic.co/t/toolongframeexception-http-header-is-larger-than-8192-bytes/17146>\
**Category:** Elasticsearch\
**Created:** [April 23, 2014, 8:26am UTC](https://discuss.elastic.co/t/toolongframeexception-http-header-is-larger-than-8192-bytes/17146 "2014-04-23T08:26:51Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ivan\_Ji](https://avatars.discourse-cdn.com/v4/letter/i/d78d45/32.png) [@Ivan\_Ji](https://discuss.elastic.co/u/Ivan_Ji)\
**Post date:** [April 23, 2014, 8:26am UTC](https://discuss.elastic.co/t/toolongframeexception-http-header-is-larger-than-8192-bytes/17146/1 "2014-04-23T08:26:51Z")

</div>

Hi all,

I am encountering an exception and this situation cannot be always  
reproduced, or in other word it's hard to reproduce.

I use python requests module to communicate with ES server by the REST  
APIs.

At the ES server side, I got the following exception:

> org.elasticsearch.common.netty.handler.codec.frame.TooLongFrameException:  
> HTTP header is larger than 8192 bytes.  
> at  
> org.elasticsearch.common.netty.handler.codec.http.HttpMessageDecoder.readHeader(HttpMessageDecoder.java:596)  
> at  
> org.elasticsearch.common.netty.handler.codec.http.HttpMessageDecoder.readHeaders(HttpMessageDecoder.java:503)  
> at  
> org.elasticsearch.common.netty.handler.codec.http.HttpMessageDecoder.decode(HttpMessageDecoder.java:193)  
> at  
> org.elasticsearch.common.netty.handler.codec.http.HttpMessageDecoder.decode(HttpMessageDecoder.java:101)  
> at  
> org.elasticsearch.common.netty.handler.codec.replay.ReplayingDecoder.callDecode(ReplayingDecoder.java:500)  
> at  
> org.elasticsearch.common.netty.handler.codec.replay.ReplayingDecoder.messageReceived(ReplayingDecoder.java:435)  
> at  
> org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)  
> at  
> org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)  
> at  
> org.elasticsearch.common.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791)  
> at  
> org.elasticsearch.common.netty.OpenChannelsHandler.handleUpstream(OpenChannelsHandler.java:74)  
> at  
> org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)  
> at  
> org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:559)  
> at  
> org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:268)  
> at  
> org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:255)  
> at  
> org.elasticsearch.common.netty.channel.socket.nio.NioWorker.read(NioWorker.java:88)  
> at  
> org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.process(AbstractNioWorker.java:108)  
> at  
> org.elasticsearch.common.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:318)  
> at  
> org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:89)  
> at  
> org.elasticsearch.common.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178)  
> at  
> org.elasticsearch.common.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)  
> at  
> org.elasticsearch.common.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)  
> at  
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)  
> at  
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

It seems the problem is very clear. But the headers I add in the request is  
far less than 8k surely. So I am confused about this situation.  
I want to know how the ES calculate the header size. Any suggestions?

Are there any limit of one document size with the REST API? The maximum  
document might be about the 2MB.

Any ideas?

Cheers,

Ivan

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/590ce49c-37a1-4b15-9b8b-2db26cf6ce8e%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/590ce49c-37a1-4b15-9b8b-2db26cf6ce8e%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)\
**Post date:** [April 23, 2014, 12:50pm UTC](https://discuss.elastic.co/t/toolongframeexception-http-header-is-larger-than-8192-bytes/17146/2 "2014-04-23T12:50:32Z")

</div>

Check your python code for HTTP header generation. After the last header  
line, two line feeds are required.

Default limit on HTTP request is 100MB.

Jörg

On Wed, Apr 23, 2014 at 10:26 AM, Ivan Ji [hxuanji@gmail.com](mailto:hxuanji@gmail.com) wrote:

> Hi all,
> 
> I am encountering an exception and this situation cannot be always  
> reproduced, or in other word it's hard to reproduce.
> 
> I use python requests module to communicate with ES server by the REST  
> APIs.
> 
> At the ES server side, I got the following exception:
> 
> > org.elasticsearch.common.netty.handler.codec.frame.TooLongFrameException:  
> > HTTP header is larger than 8192 bytes.  
> > at  
> > org.elasticsearch.common.netty.handler.codec.http.HttpMessageDecoder.readHeader(HttpMessageDecoder.java:596)  
> > at  
> > org.elasticsearch.common.netty.handler.codec.http.HttpMessageDecoder.readHeaders(HttpMessageDecoder.java:503)  
> > at  
> > org.elasticsearch.common.netty.handler.codec.http.HttpMessageDecoder.decode(HttpMessageDecoder.java:193)  
> > at  
> > org.elasticsearch.common.netty.handler.codec.http.HttpMessageDecoder.decode(HttpMessageDecoder.java:101)  
> > at  
> > org.elasticsearch.common.netty.handler.codec.replay.ReplayingDecoder.callDecode(ReplayingDecoder.java:500)  
> > at  
> > org.elasticsearch.common.netty.handler.codec.replay.ReplayingDecoder.messageReceived(ReplayingDecoder.java:435)  
> > at  
> > org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)  
> > at  
> > org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)  
> > at  
> > org.elasticsearch.common.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791)  
> > at  
> > org.elasticsearch.common.netty.OpenChannelsHandler.handleUpstream(OpenChannelsHandler.java:74)  
> > at  
> > org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)  
> > at  
> > org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:559)  
> > at  
> > org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:268)  
> > at  
> > org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:255)  
> > at  
> > org.elasticsearch.common.netty.channel.socket.nio.NioWorker.read(NioWorker.java:88)  
> > at  
> > org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.process(AbstractNioWorker.java:108)  
> > at  
> > org.elasticsearch.common.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:318)  
> > at  
> > org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:89)  
> > at  
> > org.elasticsearch.common.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178)  
> > at  
> > org.elasticsearch.common.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)  
> > at  
> > org.elasticsearch.common.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)  
> > at  
> > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)  
> > at  
> > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
> 
> It seems the problem is very clear. But the headers I add in the request  
> is far less than 8k surely. So I am confused about this situation.  
> I want to know how the ES calculate the header size. Any suggestions?
> 
> Are there any limit of one document size with the REST API? The maximum  
> document might be about the 2MB.
> 
> Any ideas?
> 
> Cheers,
> 
> Ivan
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/590ce49c-37a1-4b15-9b8b-2db26cf6ce8e%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/590ce49c-37a1-4b15-9b8b-2db26cf6ce8e%40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/590ce49c-37a1-4b15-9b8b-2db26cf6ce8e%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/590ce49c-37a1-4b15-9b8b-2db26cf6ce8e%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAKdsXoEO%3D%2BcJx-TccOf5WrqRTsik0Mj5z%2B6FEM\_y50aNOdb1eA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAKdsXoEO%3D%2BcJx-TccOf5WrqRTsik0Mj5z%2B6FEM_y50aNOdb1eA%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Ivan\_Ji](https://avatars.discourse-cdn.com/v4/letter/i/d78d45/32.png) [@Ivan\_Ji](https://discuss.elastic.co/u/Ivan_Ji)\
**Post date:** [April 24, 2014, 1:54am UTC](https://discuss.elastic.co/t/toolongframeexception-http-header-is-larger-than-8192-bytes/17146/3 "2014-04-24T01:54:42Z")

</div>

Hi Jörg,

thanks for your replies. About what you said: After the last header line,  
two line feeds are required, do you mean the headers need at least 3 lines?  
I do not get it. could you explain more?

In fact, I do trace the python requests header generation. And yes, it  
automatically add some headers for me, but it still far less than 8k. Still  
not sure what the problem is.

cheers,

Ivan

Jörg Prante於 2014年4月23日星期三UTC+8下午8時50分32秒寫道：

> Check your python code for HTTP header generation. After the last header  
> line, two line feeds are required.
> 
> Default limit on HTTP request is 100MB.
> 
> Jörg
> 
> On Wed, Apr 23, 2014 at 10:26 AM, Ivan Ji \<[hxu...@gmail.com](mailto:hxu...@gmail.com) \<javascript:\>\>wrote:
> 
> > Hi all,
> > 
> > I am encountering an exception and this situation cannot be always  
> > reproduced, or in other word it's hard to reproduce.
> > 
> > I use python requests module to communicate with ES server by the REST  
> > APIs.
> > 
> > At the ES server side, I got the following exception:
> > 
> > > org.elasticsearch.common.netty.handler.codec.frame.TooLongFrameException:  
> > > HTTP header is larger than 8192 bytes.  
> > > at  
> > > org.elasticsearch.common.netty.handler.codec.http.HttpMessageDecoder.readHeader(HttpMessageDecoder.java:596)  
> > > at  
> > > org.elasticsearch.common.netty.handler.codec.http.HttpMessageDecoder.readHeaders(HttpMessageDecoder.java:503)  
> > > at  
> > > org.elasticsearch.common.netty.handler.codec.http.HttpMessageDecoder.decode(HttpMessageDecoder.java:193)  
> > > at  
> > > org.elasticsearch.common.netty.handler.codec.http.HttpMessageDecoder.decode(HttpMessageDecoder.java:101)  
> > > at  
> > > org.elasticsearch.common.netty.handler.codec.replay.ReplayingDecoder.callDecode(ReplayingDecoder.java:500)  
> > > at  
> > > org.elasticsearch.common.netty.handler.codec.replay.ReplayingDecoder.messageReceived(ReplayingDecoder.java:435)  
> > > at  
> > > org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)  
> > > at  
> > > org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)  
> > > at  
> > > org.elasticsearch.common.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791)  
> > > at  
> > > org.elasticsearch.common.netty.OpenChannelsHandler.handleUpstream(OpenChannelsHandler.java:74)  
> > > at  
> > > org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)  
> > > at  
> > > org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:559)  
> > > at  
> > > org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:268)  
> > > at  
> > > org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:255)  
> > > at  
> > > org.elasticsearch.common.netty.channel.socket.nio.NioWorker.read(NioWorker.java:88)  
> > > at  
> > > org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.process(AbstractNioWorker.java:108)  
> > > at  
> > > org.elasticsearch.common.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:318)  
> > > at  
> > > org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:89)  
> > > at  
> > > org.elasticsearch.common.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178)  
> > > at  
> > > org.elasticsearch.common.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)  
> > > at  
> > > org.elasticsearch.common.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)  
> > > at  
> > > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)  
> > > at  
> > > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
> > 
> > It seems the problem is very clear. But the headers I add in the request  
> > is far less than 8k surely. So I am confused about this situation.  
> > I want to know how the ES calculate the header size. Any suggestions?
> > 
> > Are there any limit of one document size with the REST API? The maximum  
> > document might be about the 2MB.
> > 
> > Any ideas?
> > 
> > Cheers,
> > 
> > Ivan
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/590ce49c-37a1-4b15-9b8b-2db26cf6ce8e%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/590ce49c-37a1-4b15-9b8b-2db26cf6ce8e%40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/590ce49c-37a1-4b15-9b8b-2db26cf6ce8e%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/590ce49c-37a1-4b15-9b8b-2db26cf6ce8e%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > .  
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/7ce8fbbc-fe8a-4846-8409-8f1d18b6f82e%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/7ce8fbbc-fe8a-4846-8409-8f1d18b6f82e%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Honza\_Kral](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/honza_kral/32/876_2.png) [@Honza\_Kral](https://discuss.elastic.co/u/Honza_Kral)\
**Post date:** [April 24, 2014, 1:59am UTC](https://discuss.elastic.co/t/toolongframeexception-http-header-is-larger-than-8192-bytes/17146/4 "2014-04-24T01:59:30Z")

</div>

Hi Ivan,

can I ask you why do you use the requests library instead of the  
official client? That should work without such issues.

Thanks,  
Honza

On Thu, Apr 24, 2014 at 3:54 AM, Ivan Ji [hxuanji@gmail.com](mailto:hxuanji@gmail.com) wrote:

> Hi Jörg,
> 
> thanks for your replies. About what you said: After the last header line,  
> two line feeds are required, do you mean the headers need at least 3 lines?  
> I do not get it. could you explain more?
> 
> In fact, I do trace the python requests header generation. And yes, it  
> automatically add some headers for me, but it still far less than 8k. Still  
> not sure what the problem is.
> 
> cheers,
> 
> Ivan
> 
> Jörg Prante於 2014年4月23日星期三UTC+8下午8時50分32秒寫道：
> 
> > Check your python code for HTTP header generation. After the last header  
> > line, two line feeds are required.
> > 
> > Default limit on HTTP request is 100MB.
> > 
> > Jörg
> > 
> > On Wed, Apr 23, 2014 at 10:26 AM, Ivan Ji [hxu...@gmail.com](mailto:hxu...@gmail.com) wrote:
> > 
> > > Hi all,
> > > 
> > > I am encountering an exception and this situation cannot be always  
> > > reproduced, or in other word it's hard to reproduce.
> > > 
> > > I use python requests module to communicate with ES server by the REST  
> > > APIs.
> > > 
> > > At the ES server side, I got the following exception:
> > > 
> > > > org.elasticsearch.common.netty.handler.codec.frame.TooLongFrameException:  
> > > > HTTP header is larger than 8192 bytes.  
> > > > at  
> > > > org.elasticsearch.common.netty.handler.codec.http.HttpMessageDecoder.readHeader(HttpMessageDecoder.java:596)  
> > > > at  
> > > > org.elasticsearch.common.netty.handler.codec.http.HttpMessageDecoder.readHeaders(HttpMessageDecoder.java:503)  
> > > > at  
> > > > org.elasticsearch.common.netty.handler.codec.http.HttpMessageDecoder.decode(HttpMessageDecoder.java:193)  
> > > > at  
> > > > org.elasticsearch.common.netty.handler.codec.http.HttpMessageDecoder.decode(HttpMessageDecoder.java:101)  
> > > > at  
> > > > org.elasticsearch.common.netty.handler.codec.replay.ReplayingDecoder.callDecode(ReplayingDecoder.java:500)  
> > > > at  
> > > > org.elasticsearch.common.netty.handler.codec.replay.ReplayingDecoder.messageReceived(ReplayingDecoder.java:435)  
> > > > at  
> > > > org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)  
> > > > at  
> > > > org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)  
> > > > at  
> > > > org.elasticsearch.common.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791)  
> > > > at  
> > > > org.elasticsearch.common.netty.OpenChannelsHandler.handleUpstream(OpenChannelsHandler.java:74)  
> > > > at  
> > > > org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)  
> > > > at  
> > > > org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:559)  
> > > > at  
> > > > org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:268)  
> > > > at  
> > > > org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:255)  
> > > > at  
> > > > org.elasticsearch.common.netty.channel.socket.nio.NioWorker.read(NioWorker.java:88)  
> > > > at  
> > > > org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.process(AbstractNioWorker.java:108)  
> > > > at  
> > > > org.elasticsearch.common.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:318)  
> > > > at  
> > > > org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:89)  
> > > > at  
> > > > org.elasticsearch.common.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178)  
> > > > at  
> > > > org.elasticsearch.common.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)  
> > > > at  
> > > > org.elasticsearch.common.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)  
> > > > at  
> > > > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)  
> > > > at  
> > > > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
> > > 
> > > It seems the problem is very clear. But the headers I add in the request  
> > > is far less than 8k surely. So I am confused about this situation.  
> > > I want to know how the ES calculate the header size. Any suggestions?
> > > 
> > > Are there any limit of one document size with the REST API? The maximum  
> > > document might be about the 2MB.
> > > 
> > > Any ideas?
> > > 
> > > Cheers,
> > > 
> > > Ivan
> > > 
> > > --  
> > > You received this message because you are subscribed to the Google Groups  
> > > "elasticsearch" group.  
> > > To unsubscribe from this group and stop receiving emails from it, send an  
> > > email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).
> > > 
> > > To view this discussion on the web visit  
> > > [https://groups.google.com/d/msgid/elasticsearch/590ce49c-37a1-4b15-9b8b-2db26cf6ce8e%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/590ce49c-37a1-4b15-9b8b-2db26cf6ce8e%40googlegroups.com).  
> > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/7ce8fbbc-fe8a-4846-8409-8f1d18b6f82e%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/7ce8fbbc-fe8a-4846-8409-8f1d18b6f82e%40googlegroups.com).
> 
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CABfdDiqOFDnn7eZ0Qc%2BhJtz54fG0ELYfQnpv41nk\_LAK\_825ag%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CABfdDiqOFDnn7eZ0Qc%2BhJtz54fG0ELYfQnpv41nk_LAK_825ag%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Ivan\_Ji](https://avatars.discourse-cdn.com/v4/letter/i/d78d45/32.png) [@Ivan\_Ji](https://discuss.elastic.co/u/Ivan_Ji)\
**Post date:** [April 24, 2014, 2:21am UTC](https://discuss.elastic.co/t/toolongframeexception-http-header-is-larger-than-8192-bytes/17146/5 "2014-04-24T02:21:30Z")

</div>

Hi Honza,

In fact, this is my feature work, it supports many attractive features,  
such as persistent connection.  
But in this development status, it just need some simple REST APIs in  
matter of time I chose to use requests. maybe a mistake :P.

Although I might solve this problem by using the official python client,  
this problem still always hunt me down. I wanna know why.  
In fact, I encounter this problem only on some embed ubuntu system. In  
other PC/Server level machine, it does not happen ever.

Cheers,

Ivan

Honza Král於 2014年4月24日星期四UTC+8上午9時59分30秒寫道：

> Hi Ivan,
> 
> can I ask you why do you use the requests library instead of the  
> official client? That should work without such issues.
> 
> Thanks,  
> Honza
> 
> On Thu, Apr 24, 2014 at 3:54 AM, Ivan Ji \<[hxu...@gmail.com](mailto:hxu...@gmail.com) \<javascript:\>\>  
> wrote:
> 
> > Hi Jörg,
> > 
> > thanks for your replies. About what you said: After the last header  
> > line,  
> > two line feeds are required, do you mean the headers need at least 3  
> > lines?  
> > I do not get it. could you explain more?
> > 
> > In fact, I do trace the python requests header generation. And yes, it  
> > automatically add some headers for me, but it still far less than 8k.  
> > Still  
> > not sure what the problem is.
> > 
> > cheers,
> > 
> > Ivan
> > 
> > Jörg Prante於 2014年4月23日星期三UTC+8下午8時50分32秒寫道：
> > 
> > > Check your python code for HTTP header generation. After the last  
> > > header  
> > > line, two line feeds are required.
> > > 
> > > Default limit on HTTP request is 100MB.
> > > 
> > > Jörg
> > > 
> > > On Wed, Apr 23, 2014 at 10:26 AM, Ivan Ji [hxu...@gmail.com](mailto:hxu...@gmail.com) wrote:
> > > 
> > > > Hi all,
> > > > 
> > > > I am encountering an exception and this situation cannot be always  
> > > > reproduced, or in other word it's hard to reproduce.
> > > > 
> > > > I use python requests module to communicate with ES server by the REST  
> > > > APIs.
> > > > 
> > > > At the ES server side, I got the following exception:
> > > > 
> > > > >
> 
> org.elasticsearch.common.netty.handler.codec.frame.TooLongFrameException:
> 
> > > > > HTTP header is larger than 8192 bytes.  
> > > > > at
> 
> org.elasticsearch.common.netty.handler.codec.http.HttpMessageDecoder.readHeader(HttpMessageDecoder.java:596)
> 
> > > > > at
> 
> org.elasticsearch.common.netty.handler.codec.http.HttpMessageDecoder.readHeaders(HttpMessageDecoder.java:503)
> 
> > > > > at
> 
> org.elasticsearch.common.netty.handler.codec.http.HttpMessageDecoder.decode(HttpMessageDecoder.java:193)
> 
> > > > > at
> 
> org.elasticsearch.common.netty.handler.codec.http.HttpMessageDecoder.decode(HttpMessageDecoder.java:101)
> 
> > > > > at
> 
> org.elasticsearch.common.netty.handler.codec.replay.ReplayingDecoder.callDecode(ReplayingDecoder.java:500)
> 
> > > > > at
> 
> org.elasticsearch.common.netty.handler.codec.replay.ReplayingDecoder.messageReceived(ReplayingDecoder.java:435)
> 
> > > > > at
> 
> org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)
> 
> > > > > at
> 
> org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
> 
> > > > > at
> 
> org.elasticsearch.common.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791)
> 
> > > > > at
> 
> org.elasticsearch.common.netty.OpenChannelsHandler.handleUpstream(OpenChannelsHandler.java:74)
> 
> > > > > at
> 
> org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
> 
> > > > > at
> 
> org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:559)
> 
> > > > > at
> 
> org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:268)
> 
> > > > > at
> 
> org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:255)
> 
> > > > > at
> 
> org.elasticsearch.common.netty.channel.socket.nio.NioWorker.read(NioWorker.java:88)
> 
> > > > > at
> 
> org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.process(AbstractNioWorker.java:108)
> 
> > > > > at
> 
> org.elasticsearch.common.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:318)
> 
> > > > > at
> 
> org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:89)
> 
> > > > > at
> 
> org.elasticsearch.common.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178)
> 
> > > > > at
> 
> org.elasticsearch.common.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
> 
> > > > > at
> 
> org.elasticsearch.common.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
> 
> > > > > at
> 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
> 
> > > > > at
> 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
> 
> > > > It seems the problem is very clear. But the headers I add in the  
> > > > request  
> > > > is far less than 8k surely. So I am confused about this situation.  
> > > > I want to know how the ES calculate the header size. Any suggestions?
> > > > 
> > > > Are there any limit of one document size with the REST API? The  
> > > > maximum  
> > > > document might be about the 2MB.
> > > > 
> > > > Any ideas?
> > > > 
> > > > Cheers,
> > > > 
> > > > Ivan
> > > > 
> > > > --  
> > > > You received this message because you are subscribed to the Google  
> > > > Groups  
> > > > "elasticsearch" group.  
> > > > To unsubscribe from this group and stop receiving emails from it, send  
> > > > an  
> > > > email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).
> > > > 
> > > > To view this discussion on the web visit
> 
> [https://groups.google.com/d/msgid/elasticsearch/590ce49c-37a1-4b15-9b8b-2db26cf6ce8e%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/590ce49c-37a1-4b15-9b8b-2db26cf6ce8e%40googlegroups.com).
> 
> > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > 
> > --  
> > You received this message because you are subscribed to the Google  
> > Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send  
> > an  
> > email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > To view this discussion on the web visit
> 
> [https://groups.google.com/d/msgid/elasticsearch/7ce8fbbc-fe8a-4846-8409-8f1d18b6f82e%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/7ce8fbbc-fe8a-4846-8409-8f1d18b6f82e%40googlegroups.com).
> 
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/0e85daaf-d7bd-4444-a43b-ba1efed9af66%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/0e85daaf-d7bd-4444-a43b-ba1efed9af66%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 1:33am UTC](https://discuss.elastic.co/t/toolongframeexception-http-header-is-larger-than-8192-bytes/17146/6 "2017-07-06T01:33:52Z")

</div>


