Hefaz
Hefaz

Reputation: 671

The remote server returned an error: (413) Request Entity Too Large. Elasticsearch and JSON

I am trying to add a JSON file (263 MB) into elasticsearch. I already created a mapping for this file using Kibana, now I am trying to add it into elastic search. I am running this command in PowerShell.

C:\Users\Khan> Invoke-RestMethod "http://localhost:9200/mysofindex/_bulk?pretty" -Method Post -ContentType 'application/x-ndjson' -InFile "output.json"

but this gives me an error. something like this:

Invoke-RestMethod : The remote server returned an error: (413) Request Entity Too Large.
At line:1 char:1
+ Invoke-RestMethod "http://localhost:9200/mysofindex/_bulk?pretty" -Me ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebE 
   xception
    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand

Please tell me how can i solve this problem?

Upvotes: 12

Views: 34219

Answers (2)

gaurang101197
gaurang101197

Reputation: 31

In our case we were hitting the network limit of data node in AWS openseach cluster. One can upgrade the node to get higher limit (100MiB) if your data node has limit of 10MiB.

Source - https://docs.aws.amazon.com/opensearch-service/latest/developerguide/limits.html#network-limits

Upvotes: 2

leandrojmp
leandrojmp

Reputation: 7463

You need to change the setting http.max_content_length in your elasticsearch.yml, the default value is 100 mb, you will need to add that setting in your config file with the value you want and restart your elasticsearch nodes.

Upvotes: 21

Related Questions