Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 343
Hefaz Avatar asked Dec 31 '22 13:12

Hefaz


1 Answers

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.

like image 131
leandrojmp Avatar answered Jan 14 '23 12:01

leandrojmp