title: NodeJS Express Request Entity Too Large
body: <p>I've tried many solutions listed here (increasing of memory limit, adding parameterlimit, adding type as 'application/json') to fix this 'Request Entity too large' error (it also returns http code 413). But none of them seem to make this error go away.</p>
  
  <p>The current size of the json can range from 200k up to 400k entities.</p>
  
  <p>Here is the current configuration:</p>
  
  <pre><code>app.use( bodyParser.json({limit: "15360mb", type:'application/json'}) );      
  app.use(bodyParser.urlencoded({
    limit: "15360mb",
    extended: true,
    parameterLimit:5000000,
    type:'application/json'
  })); 
  app.use(bodyParser())
  </code></pre>
  
  <p>Any ideas on how to increase the limit?</p>
  
  <p><strong>More information</strong></p>
  
  <p>This is the full error message if it helps:</p>
  
  <pre><code>    { Error: Request Entity Too Large
          at respond (/home/nodejs/server/node_modules/elasticsearch/src/lib/transport.js:307:15)
          at checkRespForFailure (/home/nodejs/server/node_modules/elasticsearch/src/lib/transport.js:266:7)
          at HttpConnector.&lt;anonymous&gt; (/home/nodejs/server/node_modules/elasticsearch/src/lib/connectors/http.js:159:7)
          at IncomingMessage.bound (/home/nodejs/server/node_modules/lodash/dist/lodash.js:729:21)
          at emitNone (events.js:111:20)
          at IncomingMessage.emit (events.js:208:7)
          at endReadableNT (_stream_readable.js:1056:12)
          at _combinedTickCallback (internal/process/next_tick.js:138:11)
          at process._tickCallback (internal/process/next_tick.js:180:9)
        status: 413,
        displayName: 'RequestEntityTooLarge',
        message: 'Request Entity Too Large',
        path: '/_bulk',
        query: {},
        body: '&lt;large body here&gt;'
  }
  </code></pre>
  
  <p><strong>Solution</strong></p>
  
  <p>The error was indeed due to wrong configuration on elasticsearch and not nodejs. Manage to fix this by following <a href="https://github.com/elastic/elasticsearch-js/issues/241" rel="nofollow noreferrer">https://github.com/elastic/elasticsearch-js/issues/241</a> and setting <code>http.max_content_length: 500mb</code> in <code>elasticsearch.yml</code>.</p>
  
  <p>@ryanlutgen also provided a link for more information about this error here.
   <a href="https://github.com/elastic/elasticsearch/issues/2902" rel="nofollow noreferrer">https://github.com/elastic/elasticsearch/issues/2902</a></p>
  
  <p>This issue has been fixed. Thanks for all the input!</p>