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

Hef*_*faz 2 powershell json 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
Run Code Online (Sandbox Code Playgroud)

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

lea*_*jmp 8

您需要更改设置http.max_content_length你的elasticsearch.yml,默认值是100 MB,你将需要补充的是设置在您的配置文件,您需要的值,然后重新启动elasticsearch节点。

  • 它不存在,因为它使用默认值 100 mb,您需要将配置添加到 `elasticsearch.yml`,有关更多设置,请参阅[文档](https://www.elastic.co/guide /en/elasticsearch/reference/7.3/modules-http.html) (2认同)