# Unable to import ndjson file into kibana bashboard using API

**URL:** https://discuss.elastic.co/t/unable-to-import-ndjson-file-into-kibana-bashboard-using-api/360670
**Category:** Kibana
**Created:** [June 2, 2024, 10:21am UTC](https://discuss.elastic.co/t/unable-to-import-ndjson-file-into-kibana-bashboard-using-api/360670 "2024-06-02T10:21:48Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![koushii](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/koushii/32/121813_2.png) [@koushii](https://discuss.elastic.co/u/koushii)
#### Post date: [June 2, 2024, 10:21am UTC](https://discuss.elastic.co/t/unable-to-import-ndjson-file-into-kibana-bashboard-using-api/360670/1 "2024-06-02T10:21:48Z")

</div>

Hey Everyone,

I'm stuck at a point of importing dashboard(ndjson) file which I exported into kibana using API.  
I've tried below commands as per AWS Official documentation.

curl -X POST https://\<kibana\_URL\>/\_plugin/kibana/auth/login -H "kbn-xsrf: true" -H "content-type:application/json" -d '{"username":"user", "password" : "pass"} ' -c auth.txt

curl -X POST https://\<kibana\_URL\>/\_plugin/kibana/api/saved\_objects/\_import -H "kbn-xsrf:true" -b auth.txt --form file=@test.ndjson

I'm able to login and export the dashboard. But when i try to import it's giving below error.

It was taking 1 min of time and later throwing below error. Even for very small dashboards as well it's the same error.

Can some one please help me. Stuck at this point since 3 restless days.

====================

- We are completely uploaded and fine

\< HTTP/1.1 504 Gateway Time-out  
\< Server: nginx  
\< Date: Sun, 02 Jun 2024 10:12:08 GMT  
\< Content-Type: text/html  
\< Content-Length: 160  
\< Connection: keep-alive  
\<

504 Gateway Time-out
# 504 Gateway Time-out

* * *
nginx \* Connection #0 to host left intact ==============

---

<div class="post-metadata">

### Author: ![koushii](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/koushii/32/121813_2.png) [@koushii](https://discuss.elastic.co/u/koushii)
#### Post date: [June 2, 2024, 10:22am UTC](https://discuss.elastic.co/t/unable-to-import-ndjson-file-into-kibana-bashboard-using-api/360670/2 "2024-06-02T10:22:44Z")

</div>

I'm able to import this via UI. The issue i'm facing from is via API.

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [June 2, 2024, 2:22pm UTC](https://discuss.elastic.co/t/unable-to-import-ndjson-file-into-kibana-bashboard-using-api/360670/3 "2024-06-02T14:22:41Z")

</div>

Welcome!

> [@koushii](#):
>
> as per AWS Official documentation.

What do you mean? Kibana is made by elastic.

Sounds like the error message is from nginx and not Kibana. I suspect that you are not running a real version of Kibana. Which version is Elasticsearch?

---

<div class="post-metadata">

### Author: ![koushii](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/koushii/32/121813_2.png) [@koushii](https://discuss.elastic.co/u/koushii)
#### Post date: [June 2, 2024, 6:47pm UTC](https://discuss.elastic.co/t/unable-to-import-ndjson-file-into-kibana-bashboard-using-api/360670/4 "2024-06-02T18:47:14Z")

</div>

Hey, Thanks for your swift response.

The version I'm using is 7.9

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [June 2, 2024, 7:26pm UTC](https://discuss.elastic.co/t/unable-to-import-ndjson-file-into-kibana-bashboard-using-api/360670/5 "2024-06-02T19:26:23Z")

</div>

Upgrade to 7.17 at least or 8.13.4.

---

<div class="post-metadata">

### Author: ![koushii](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/koushii/32/121813_2.png) [@koushii](https://discuss.elastic.co/u/koushii)
#### Post date: [June 2, 2024, 8:33pm UTC](https://discuss.elastic.co/t/unable-to-import-ndjson-file-into-kibana-bashboard-using-api/360670/6 "2024-06-02T20:33:08Z")

</div>

You are saying error is w.r.t nginx. How could version upgrade solve this issue.  
Please let me know 🙂

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [June 2, 2024, 8:50pm UTC](https://discuss.elastic.co/t/unable-to-import-ndjson-file-into-kibana-bashboard-using-api/360670/7 "2024-06-02T20:50:31Z")

</div>

I don't know if it will solve your issue. Probably not, but at least you will use a "safe" version and not an outdated one.

---

<div class="post-metadata">

### Author: ![koushii](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/koushii/32/121813_2.png) [@koushii](https://discuss.elastic.co/u/koushii)
#### Post date: [June 3, 2024, 4:03am UTC](https://discuss.elastic.co/t/unable-to-import-ndjson-file-into-kibana-bashboard-using-api/360670/8 "2024-06-03T04:03:30Z")

</div>

I was able to import dashboards from UI. But when I try from kibana import api  
https://\<kibana\_URL\>/\_plugin/kibana/api/saved\_objects/\_import

Then I'm facing this issue. I wonder that import API worked some time for me and later it started giving this error.

---

<div class="post-metadata">

### Author: ![koushii](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/koushii/32/121813_2.png) [@koushii](https://discuss.elastic.co/u/koushii)
#### Post date: [June 3, 2024, 4:34am UTC](https://discuss.elastic.co/t/unable-to-import-ndjson-file-into-kibana-bashboard-using-api/360670/9 "2024-06-03T04:34:13Z")

</div>

On executing below approach it seems like I was able to send the ndjson file to kibana. But Kibana was unable to process.

curl -X POST -v \<kibana\_URL\>/\_plugin/kibana/api/saved\_objects/\_import -H "kbn-xsrf:true" -b auth.txt --form file=@test.ndjson

===================================  
Note: Unnecessary use of -X or --request, POST is already inferred.

- Host \<kibana\_URL\>:443 was resolved.

- IPv6: (none)

- IPv4: 13.54.149.250

- Trying 13.54.149.250:443...

- Connected to \<kibana\_URL\> (13.54.149.250) port 443

- ALPN: curl offers h2,http/1.1

- (304) (OUT), TLS handshake, Client hello (1):

- CAfile: /etc/ssl/cert.pem

- CApath: none

- (304) (IN), TLS handshake, Server hello (2):

- (304) (IN), TLS handshake, Unknown (8):

- (304) (IN), TLS handshake, Certificate (11):

- (304) (IN), TLS handshake, CERT verify (15):

- (304) (IN), TLS handshake, Finished (20):

- (304) (OUT), TLS handshake, Finished (20):

- SSL connection using TLSv1.3 / AEAD-AES256-GCM-SHA384 / [blank] / UNDEF

- ALPN: server accepted http/1.1

- Server certificate:

- subject: C=GB; L=London; O=IMImobile Limited; CN=\*.imiconnect.com

- start date: Sep 20 00:00:00 2023 GMT

- expire date: Oct 20 23:59:59 2024 GMT

- issuer: C=US; O=DigiCert Inc; CN=DigiCert Global G2 TLS RSA SHA256 2020 CA1

- SSL certificate verify ok.

- using HTTP/1.x

> POST /\_plugin/kibana/api/saved\_objects/\_import HTTP/1.1

> User-Agent: curl/8.6.0

> Accept: _/_

> Cookie: security\_authentication=Fe26.2\*\*10139ab39834bb569f5b843f0aef738a7bb640410d82033483b7H3dqsxNMSWnu3sKKxPijZpIq2kGb4ZqeQOQW20ZdBagwAvMDO-CeP8lEvwM1caefeed253eb76298c0d4015270e4455480bfb597265fa8bea6b4321f14b6\*iwasJTjQKfrRiw3r2GQYrjPv9w\_wtMgSdBy6Ubjt7GA

> kbn-xsrf:true

> Content-Length: 23644

> Content-Type: multipart/form-data; boundary=------------------------5DKENfBvBQAP78uMqgiNOT

> 

- We are completely uploaded and fine

\< HTTP/1.1 504 Gateway Time-out

\< Server: nginx

\< Date: Sun, 02 Jun 2024 10:12:08 GMT

\< Content-Type: text/html

\< Content-Length: 160

\< Connection: keep-alive

\<

504 Gateway Time-out
# 504 Gateway Time-out

* * *
nginx
- Connection #0 to host \<Kibana\_URL\> left intact

===================================

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [June 3, 2024, 6:47am UTC](https://discuss.elastic.co/t/unable-to-import-ndjson-file-into-kibana-bashboard-using-api/360670/10 "2024-06-03T06:47:55Z")

</div>

Do you have nginx running? Could directly call kibana instead ?

Also check the content-type. You are not providing it when running the curl command.
