远程服务器返回错误:(413)请求实体太大。 Elasticsearch和JSON

时间:2019-10-21 16:11:43

标签: json powershell elasticsearch kibana

我正在尝试将一个JSON文件(263 MB)添加到elasticsearch中。我已经使用Kibana为此文件创建了映射,现在我正尝试将其添加到弹性搜索中。我正在PowerShell中运行此命令。

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

但这给我一个错误。像这样的东西:

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

请告诉我如何解决这个问题?

1 个答案:

答案 0 :(得分:1)

您需要在http.max_content_length中更改设置elasticsearch.yml,默认值为100 mb,您需要将该配置添加到您想要的值中,并重新启动您的elasticsearch节点

相关问题