Load data in Powershell Windows

Trying to load Shakespear example data into elasticsearch using Windows powershell and got this auth error. (I downloaded file on my User/Documents folder by the way)
I am connected to Elasticsearch port(9200) and Kibana port(5601) successfully and I have gone far to mapping setup before type on Powershell. (PUT method)
And, I also unzipped Logstash.
I am Windows machine.
Plus, I installed Elasticsearch with .msi file so there is no config.yml file on my Elastic 6.3.0 folder as far as I know

PS C:\Users\joshu\documents> Invoke-RestMethod "http://localhost:9200/shakespeare/doc/_bulk?pretty" -Method Post -ContentType 'application/x-ndjson' -InFile "shakespeare_6.0.json"
Invoke-RestMethod : {
  "error" : {
    "root_cause" : [
      {
        "type" : "security_exception",
        "reason" : "missing authentication token for REST request [/shakespeare/doc/_bulk?pretty]",
        "header" : {
          "WWW-Authenticate" : "Basic realm=\"security\" charset=\"UTF-8\""
        }
      }
    ],
    "type" : "security_exception",
    "reason" : "missing authentication token for REST request [/shakespeare/doc/_bulk?pretty]",
    "header" : {
      "WWW-Authenticate" : "Basic realm=\"security\" charset=\"UTF-8\""
    }
  },
  "status" : 401
}
所在位置 行:1 字符: 1
+ Invoke-RestMethod "http://localhost:9200/shakespeare/doc/_bulk?pretty ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod],WebException
    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand

PS C:\Users\joshu\documents>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.