Importing data with cURL error. Newb here

Hey guys,

I've been learning Elasticsearch and Kibana for 2-3 days now. I'm super newbie and I know it but I was wondering if anyone can lend a hand.

Issue: I'm trying to pass a json file to my kibana session using the following command:

curl -H "Content-Type: application/json" -XPOST "http://localhost:9200/product/default/_bulk?pretty" --data-binary "@file_name.json"

However, I get the following error:

{
  "error" : {
    "root_cause" : [
      {
        "type" : "security_exception",
        "reason" : "missing authentication token for REST request [/product/default/_bulk?pretty]",
        "header" : {
          "WWW-Authenticate" : "Basic realm=\"security\" charset=\"UTF-8\""
        }
      }
    ],
    "type" : "security_exception",
    "reason" : "missing authentication token for REST request [/product/default/_bulk?pretty]",
    "header" : {
      "WWW-Authenticate" : "Basic realm=\"security\" charset=\"UTF-8\""
    }
  },
  "status" : 401

I already saw some posts that discussed the following:

  • xpack.security.encryptionKey: "something_at_least_32_characters"
  • xpack.security.enabled: false

But unfortunately messing with these settings in the .yml file hasn't helped.

Not sure if this helps but when I start my Kibana, I get some red errors and warnings:

  log   [02:18:44.265] [info][status][plugin:kibana@6.2.4] Status changed from uninitialized to green - Ready
  log   [02:18:44.332] [info][status][plugin:elasticsearch@6.2.4] Status changed from uninitialized to yellow - Waiting for Elasticsearch
  log   [02:18:44.338] [info][status][plugin:xpack_main@6.2.4] Status changed from uninitialized to yellow - Waiting for Elasticsearch
  log   [02:18:44.353] [info][status][plugin:searchprofiler@6.2.4] Status changed from uninitialized to yellow - Waiting for Elasticsearch
  log   [02:18:44.360] [info][status][plugin:ml@6.2.4] Status changed from uninitialized to yellow - Waiting for Elasticsearch
  log   [02:18:44.433] [info][status][plugin:tilemap@6.2.4] Status changed from uninitialized to yellow - Waiting for Elasticsearch
  log   [02:18:44.438] [info][status][plugin:watcher@6.2.4] Status changed from uninitialized to yellow - Waiting for Elasticsearch
  log   [02:18:44.493] [info][status][plugin:license_management@6.2.4] Status changed from uninitialized to green - Ready
  log   [02:18:44.945] [info][status][plugin:timelion@6.2.4] Status changed from uninitialized to green - Ready
  log   [02:18:44.954] [info][status][plugin:graph@6.2.4] Status changed from uninitialized to yellow - Waiting for Elasticsearch
  log   [02:18:44.970] [info][status][plugin:monitoring@6.2.4] Status changed from uninitialized to green - Ready
  log   [02:18:50.840] [warning][reporting] Generating a random key for xpack.reporting.encryptionKey. To prevent pending reports from failing on restart, please set xpack.reporting.encryptionKey in kibana.yml
  log   [02:18:50.856] [info][status][plugin:reporting@6.2.4] Status changed from uninitialized to yellow - Waiting for Elasticsearch
  log   [02:18:50.918] [error][status][plugin:xpack_main@6.2.4] Status changed from yellow to red - Request Timeout after 3000ms
  log   [02:18:50.919] [error][status][plugin:searchprofiler@6.2.4] Status changed from yellow to red - Request Timeout after 3000ms
  log   [02:18:50.921] [error][status][plugin:ml@6.2.4] Status changed from yellow to red - Request Timeout after 3000ms
  log   [02:18:50.924] [error][status][plugin:tilemap@6.2.4] Status changed from yellow to red - Request Timeout after 3000ms
  log   [02:18:50.929] [error][status][plugin:watcher@6.2.4] Status changed from yellow to red - Request Timeout after 3000ms
  log   [02:18:50.930] [error][status][plugin:graph@6.2.4] Status changed from yellow to red - Request Timeout after 3000ms
  log   [02:18:50.932] [error][status][plugin:reporting@6.2.4] Status changed from yellow to red - Request Timeout after 3000ms
  log   [02:18:50.940] [error][status][plugin:elasticsearch@6.2.4] Status changed from yellow to red - Request Timeout after 3000ms
  log   [02:18:51.249] [info][license][xpack] Imported license information from Elasticsearch for the [data] cluster: mode: trial | status: active | expiry date: 2018-06-09T21:52:48-04:00
  log   [02:18:51.263] [info][status][plugin:xpack_main@6.2.4] Status changed from red to green - Ready
  log   [02:18:51.264] [info][status][plugin:searchprofiler@6.2.4] Status changed from red to green - Ready
  log   [02:18:51.265] [info][status][plugin:ml@6.2.4] Status changed from red to green - Ready
  log   [02:18:51.267] [info][status][plugin:tilemap@6.2.4] Status changed from red to green - Ready
  log   [02:18:51.268] [info][status][plugin:watcher@6.2.4] Status changed from red to green - Ready
  log   [02:18:51.269] [info][status][plugin:graph@6.2.4] Status changed from red to green - Ready
  log   [02:18:51.270] [info][status][plugin:reporting@6.2.4] Status changed from red to green - Ready
  log   [02:18:51.294] [info][kibana-monitoring][monitoring-ui] Stopping all Kibana monitoring collectors
  log   [02:18:51.328] [info][license][xpack] Imported license information from Elasticsearch for the [monitoring] cluster: mode: trial | status: active | expiry date: 2018-06-09T21:52:48-04:00
  log   [02:18:57.073] [info][kibana-monitoring][monitoring-ui] Starting all Kibana monitoring collectors
  log   [02:18:57.078] [info][status][plugin:elasticsearch@6.2.4] Status changed from red to green - Ready
  log   [02:19:13.284] [info][status][plugin:security@6.2.4] Status changed from uninitialized to green - Ready
  log   [02:19:13.292] [warning][security] Generating a random key for xpack.security.encryptionKey. To prevent sessions from being invalidated on restart, please set xpack.security.encryptionKey in kibana.yml
  log   [02:19:13.301] [warning][security] Session cookies will be transmitted over insecure connections. This is not recommended.
  log   [02:19:13.379] [info][status][plugin:grokdebugger@6.2.4] Status changed from uninitialized to green - Ready
  log   [02:19:13.391] [info][status][plugin:dashboard_mode@6.2.4] Status changed from uninitialized to green - Ready
  log   [02:19:13.396] [info][status][plugin:logstash@6.2.4] Status changed from uninitialized to green - Ready
  log   [02:19:13.439] [info][status][plugin:apm@6.2.4] Status changed from uninitialized to green - Ready
  log   [02:19:13.479] [info][status][plugin:console@6.2.4] Status changed from uninitialized to green - Ready
  log   [02:19:13.488] [info][status][plugin:metrics@6.2.4] Status changed from uninitialized to green - Ready
  log   [02:19:13.525] [info][listening] Server running at http://localhost:5601

Thank you!

Hi,

I believe you are using X-pack. You haven't provided authentication credentials to curl query. Please add those in the following format -u <username>:<password> to your curl request.

A similar thread to your can be found here.

Hope this helps you out.

1 Like

Thanks a million!

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