# Mapping ndjson

**URL:** <https://discuss.elastic.co/t/mapping-ndjson/209617>\
**Category:** Kibana\
**Created:** [November 27, 2019, 6:55am UTC](https://discuss.elastic.co/t/mapping-ndjson/209617 "2019-11-27T06:55:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![111228](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/111228/32/56505_2.png) [@111228](https://discuss.elastic.co/u/111228)\
**Post date:** [November 27, 2019, 6:55am UTC](https://discuss.elastic.co/t/mapping-ndjson/209617/1 "2019-11-27T06:55:02Z")

</div>

Good day  
How can I import .ndjson file by a command without GUI

---

<div class="post-metadata">

**Author:** ![markov00](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/markov00/32/33316_2.png) [@markov00](https://discuss.elastic.co/u/markov00)\
**Post date:** [November 27, 2019, 11:19am UTC](https://discuss.elastic.co/t/mapping-ndjson/209617/2 "2019-11-27T11:19:38Z")

</div>

Hi @111228

You can accomplish that using the ES Bulk API:

```auto
curl -X PUT "localhost:9200/sample_data/_bulk?pretty" -H 'Content-Type: application/x-ndjson' --data-binary @sample.json

```

see this post for reference:

> [@Put JSON into elasticsearch?](https://discuss.elastic.co/t/put-json-into-elasticsearch/178971/5):
>
> Using [Bulk API](https://www.elastic.co/guide/en/elasticsearch/reference/7.0/docs-bulk.html), i did indeed get it to work ! Here's the final document { "index": {"\_id":"1"}} { "type":"train", "name":"T01", "state":"inactive", "time":"2019-12-20 08:48:12" } { "index" : { "\_id" : "2" } } { "type":"train", "name":"T02", "state":"active", "time":"2019-12-20 08:48:12" } As well as the command used to upload the file: curl -X PUT "localhost:9200/sample\_data/\_bulk?pretty" -H 'Content-Type: application/x-ndjson' --data-binary @sample.json To any future readers: notice the…

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [December 25, 2019, 11:19am UTC](https://discuss.elastic.co/t/mapping-ndjson/209617/3 "2019-12-25T11:19:38Z")

</div>

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