# Upload json file into elasticsearch

**URL:** <https://discuss.elastic.co/t/upload-json-file-into-elasticsearch/164812>\
**Category:** Elasticsearch\
**Created:** [January 18, 2019, 2:39pm UTC](https://discuss.elastic.co/t/upload-json-file-into-elasticsearch/164812 "2019-01-18T14:39:42Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alaoui](https://avatars.discourse-cdn.com/v4/letter/a/4af34b/32.png) [@Alaoui](https://discuss.elastic.co/u/Alaoui)\
**Post date:** [January 18, 2019, 2:39pm UTC](https://discuss.elastic.co/t/upload-json-file-into-elasticsearch/164812/1 "2019-01-18T14:39:42Z")

</div>

I want to upload a json file but it doesn t work, this is my config file 🙂

input{  
file{  
type =\> "json"  
path =\> "D:\Js.json"  
start\_position =\> "beginning"  
sincedb\_path =\> "/dev/null"  
}  
}  
filter{

```
json{
	source => "message"
}

```

}  
output{  
elasticsearch{  
hosts =\> "localhost:9200"  
index =\> "xoxoxo"  
document\_type =\> "xoxoxofiles"  
}  
stdout{}  
}

and this my json file :

{"menu": {  
"id": "file",  
"value": "File",  
"popup": {  
"menuitem": [  
{"value": "New", "onclick": "CreateNewDoc()"},  
{"value": "Open", "onclick": "OpenDoc()"},  
{"value": "Close", "onclick": "CloseDoc()"}  
]  
}  
}}

---

<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:** [January 18, 2019, 4:20pm UTC](https://discuss.elastic.co/t/upload-json-file-into-elasticsearch/164812/2 "2019-01-18T16:20:49Z")

</div>

Are you sure you want to use logstash for that?

---

<div class="post-metadata">

**Author:** ![Alaoui](https://avatars.discourse-cdn.com/v4/letter/a/4af34b/32.png) [@Alaoui](https://discuss.elastic.co/u/Alaoui)\
**Post date:** [January 18, 2019, 4:24pm UTC](https://discuss.elastic.co/t/upload-json-file-into-elasticsearch/164812/3 "2019-01-18T16:24:36Z")

</div>

yes , because my boss told me to upload 100 json files using logstash ☹ what i should to use then !!!!!

---

<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:** [January 18, 2019, 4:39pm UTC](https://discuss.elastic.co/t/upload-json-file-into-elasticsearch/164812/4 "2019-01-18T16:39:55Z")

</div>

curl in a shell script...  
I mean that I'd not try to complicate things unless you need to do advanced transformations...

---

<div class="post-metadata">

**Author:** ![Alaoui](https://avatars.discourse-cdn.com/v4/letter/a/4af34b/32.png) [@Alaoui](https://discuss.elastic.co/u/Alaoui)\
**Post date:** [January 18, 2019, 4:43pm UTC](https://discuss.elastic.co/t/upload-json-file-into-elasticsearch/164812/5 "2019-01-18T16:43:39Z")

</div>

can we talke in a private using email ?? if its okey

---

<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:** [January 18, 2019, 5:06pm UTC](https://discuss.elastic.co/t/upload-json-file-into-elasticsearch/164812/6 "2019-01-18T17:06:36Z")

</div>

Unless you want to share secret settings, I prefer keeping the discussion here as it can help the community and the community can also help.

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [January 18, 2019, 5:10pm UTC](https://discuss.elastic.co/t/upload-json-file-into-elasticsearch/164812/7 "2019-01-18T17:10:55Z")

</div>

> [@Alaoui](#):
>
> sincedb\_path =\> "/dev/null"

This is the setting for Linux, but as it looks like you are using Windows it should probably be `sincedb_path => "NUL"` instead.

As your JSON object seems to span multiple lines, you will need to also use a [multiline codec](https://www.elastic.co/guide/en/logstash/current/plugins-codecs-multiline.html).

> [@Alaoui](#):
>
> document\_type =\> "xoxoxofiles"

Recent version of Elasticsearch only support a single type per index, so you can probably remove this.

---

<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:** [February 15, 2019, 5:11pm UTC](https://discuss.elastic.co/t/upload-json-file-into-elasticsearch/164812/8 "2019-02-15T17:11:05Z")

</div>

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