# Loading json file in ES 6.4

**URL:** <https://discuss.elastic.co/t/loading-json-file-in-es-6-4/152722>\
**Category:** Elasticsearch\
**Created:** [October 16, 2018, 9:03pm UTC](https://discuss.elastic.co/t/loading-json-file-in-es-6-4/152722 "2018-10-16T21:03:13Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![aliyesami](https://avatars.discourse-cdn.com/v4/letter/a/ecb155/32.png) [@aliyesami](https://discuss.elastic.co/u/aliyesami)\
**Post date:** [October 16, 2018, 9:03pm UTC](https://discuss.elastic.co/t/loading-json-file-in-es-6-4/152722/1 "2018-10-16T21:03:13Z")

</div>

in 6.4 I am getting error trying to load the index

$ curl -XPUT node1:9200/test2idx --data-binary -H'Content-Type: application/json' @test.json  
{"error":"Content-Type header [application/x-www-form-urlencoded] is not supported","status":406}curl: (6) Could not resolve host: test.json; Name or service not known

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [October 16, 2018, 9:08pm UTC](https://discuss.elastic.co/t/loading-json-file-in-es-6-4/152722/2 "2018-10-16T21:08:55Z")

</div>

That is not the right format for curl, you need to use the `-d` flag to pass in the file.

---

<div class="post-metadata">

**Author:** ![aliyesami](https://avatars.discourse-cdn.com/v4/letter/a/ecb155/32.png) [@aliyesami](https://discuss.elastic.co/u/aliyesami)\
**Post date:** [October 16, 2018, 9:23pm UTC](https://discuss.elastic.co/t/loading-json-file-in-es-6-4/152722/3 "2018-10-16T21:23:00Z")

</div>

can you please give me the right syntax?

---

<div class="post-metadata">

**Author:** ![aliyesami](https://avatars.discourse-cdn.com/v4/letter/a/ecb155/32.png) [@aliyesami](https://discuss.elastic.co/u/aliyesami)\
**Post date:** [October 16, 2018, 9:27pm UTC](https://discuss.elastic.co/t/loading-json-file-in-es-6-4/152722/4 "2018-10-16T21:27:51Z")

</div>

even creating the index is not working ,this example is from the ES site.

$ curl -XPUT [http://node1:9200/shakespeare](http://node1:9200/shakespeare) -d '

> {  
> "mappings" : {  
> "_default_" : {  
> "properties" : {  
> "speaker" : {"type": "string", "index" : "not\_analyzed" },  
> "play\_name" : {"type": "string", "index" : "not\_analyzed" },  
> "line\_id" : { "type" : "integer" },  
> "speech\_number" : { "type" : "integer" }  
> }  
> }  
> }  
> }  
> ';  
> {"error":"Content-Type header [application/x-www-form-urlencoded] is not supported","status":406}[elasticsearch@dotstohdadn201 ~]$  
> [elasticsearch@node1 ~]$

---

<div class="post-metadata">

**Author:** ![aliyesami](https://avatars.discourse-cdn.com/v4/letter/a/ecb155/32.png) [@aliyesami](https://discuss.elastic.co/u/aliyesami)\
**Post date:** [October 16, 2018, 9:30pm UTC](https://discuss.elastic.co/t/loading-json-file-in-es-6-4/152722/5 "2018-10-16T21:30:38Z")

</div>

I also tried using -H content type syntax , got different error

[elasticsearch@node1 ~]$ curl -XPUT [http://node1:9200/shakespeare](http://node1:9200/shakespeare) -H 'Content-Type: application/json' -d '

> {  
> "mappings" : {  
> "_default_" : {  
> "properties" : {  
> "speaker" : {"type": "string", "index" : "not\_analyzed" },  
> "play\_name" : {"type": "string", "index" : "not\_analyzed" },  
> "line\_id" : { "type" : "integer" },  
> "speech\_number" : { "type" : "integer" }  
> }  
> }  
> }  
> }  
> ';  
> {"error":{"root\_cause":[{"type":"mapper\_parsing\_exception","reason":"No handler for type [string] declared on field [play\_name]"}],"type":"mapper\_parsing\_exception","reason":"Failed to parse mapping [_default_]: No handler for type [string] declared on field [play\_name]","caused\_by":{"type":"mapper\_parsing\_exception","reason":"No handler for type [string] declared on field [play\_name]"}},"status":400}[elasticsearch@node1 ~]$  
> [elasticsearch@node1 ~]$

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [October 16, 2018, 9:33pm UTC](https://discuss.elastic.co/t/loading-json-file-in-es-6-4/152722/6 "2018-10-16T21:33:05Z")

</div>

Can you link us to the document page you are reading?

---

<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:** [November 13, 2018, 9:33pm UTC](https://discuss.elastic.co/t/loading-json-file-in-es-6-4/152722/7 "2018-11-13T21:33:05Z")

</div>

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