0
當我通過PowerShell將數據導入ElasticSearch時,它總是拋出異常,任何人都可以幫助我?由PowerShell批量數據到ElasticSearch,但拋出異常
代碼:
$a = "{'create':{'_index':'kuyu','_type':'test','_id':'4'}}`n{'title': 'this is a test', 'text': 'test', 'date': '2016-01-02'}".Replace("'","`"")
Invoke-RestMethod -Uri http://localhost:9200/_bulk -Method POST -Body $a
的例外是:
Invoke-RestMethod : {"error":{"root_cause":[{"type":"action_request_validation_exception","reason":"Validation Failed: 1: no requests added;"}],"type":"action_request_validation_exception","reason":"Validation Failed: 1: no requests added;"},"status":400}
At line:1 char:1
+ Invoke-RestMethod -Uri http://localhost:9200/_bulk -Method POST -Bo ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
是, 它是!非常感謝!! –
真棒,很高興它幫助! – Val