# Making an explicit mapping

**URL:** <https://discuss.elastic.co/t/making-an-explicit-mapping/47392>\
**Category:** Elasticsearch\
**Created:** [April 14, 2016, 1:38pm UTC](https://discuss.elastic.co/t/making-an-explicit-mapping/47392 "2016-04-14T13:38:02Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jervdv](https://avatars.discourse-cdn.com/v4/letter/j/ed655f/32.png) [@jervdv](https://discuss.elastic.co/u/jervdv)\
**Post date:** [April 14, 2016, 1:38pm UTC](https://discuss.elastic.co/t/making-an-explicit-mapping/47392/1 "2016-04-14T13:38:02Z")

</div>

When i want to make a mapping in command line i always get an empty mapping back while it works perfectly in my sense extension.  
This is what i do

curl -XPUT [http://localhost:9200/twitter](http://localhost:9200/twitter) -d mapping.json  
curl -XGET [http://localhost:9200/twitter/\_mapping/?pretty=1](http://localhost:9200/twitter/_mapping/?pretty=1)

this is what my last command returns:  
"{  
"twitter": {  
"mappings" : { }  
}  
}

Does anyone know what i'm doing wrong?  
Even when i try it with the original data from the tutorial it keeps outputing the same empty mappings.

This is the content of my maping.json file:  
{  
"mappings": {  
"appconsole" : {  
"\_timestamp": {  
"enabled": true,  
"store": "yes"  
},  
"\_version": {  
"type": "string"  
},  
"dynamic": "strict",  
"properties" : {  
"message": {  
"type": "string"  
},  
"Log\_Level2": {  
"type": "string"  
},  
"errormsg": {  
"type": "string"  
},  
"geoip": {  
"dynamic" : "true",  
"properties" : {  
"ip" : {  
"type" : "ip"  
},  
"latitude" : {  
"type" : "float"  
},  
"location" : {  
"type" : "geo\_point"  
},  
"longitude" : {  
"type" : "float"  
}  
}  
},"date" : {  
"type" : "date",  
"format": "yyyy/MM/dd"  
},  
"highTime" : {  
"type" : "string"  
},  
"lowTime" : {  
"type" : "string"  
},  
"package" : {  
"type" : "string"  
},  
"Log\_Level" : {  
"type" : "string"  
}  
}  
}  
}  
}

original data from tutorial:  
`{ "mappings" : { "twitter" : {"properties" : { "message" : { "type" : "string", "store" : "true" }}}}}`

---

<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:** [April 14, 2016, 1:50pm UTC](https://discuss.elastic.co/t/making-an-explicit-mapping/47392/2 "2016-04-14T13:50:15Z")

</div>

Please format your code.

That's not how curl is working.

IIRC you have to use `@filename.json` or something like this.

---

<div class="post-metadata">

**Author:** ![jervdv](https://avatars.discourse-cdn.com/v4/letter/j/ed655f/32.png) [@jervdv](https://discuss.elastic.co/u/jervdv)\
**Post date:** [April 14, 2016, 2:03pm UTC](https://discuss.elastic.co/t/making-an-explicit-mapping/47392/3 "2016-04-14T14:03:11Z")

</div>

> [@dadoonet](#):
>
> IIRC you have to use @file

If i use curl -XPUT [http://localhost:9200/twitter](http://localhost:9200/twitter) -d @mapping.json  
with the original data from the tutorial

`{ "mappings" : { "twitter" : {"properties" : { "message" : { "type" : "string", "store" : "true" }}}}}`

i get  
{"acknowledged":true}curl: (6) Couldn't resolve host 'mappings'

Any ideas?

---

<div class="post-metadata">

**Author:** ![jervdv](https://avatars.discourse-cdn.com/v4/letter/j/ed655f/32.png) [@jervdv](https://discuss.elastic.co/u/jervdv)\
**Post date:** [April 14, 2016, 2:25pm UTC](https://discuss.elastic.co/t/making-an-explicit-mapping/47392/4 "2016-04-14T14:25:01Z")

</div>

@dadoonet  
Thanks for the idea it was indead a wrong format of the curl command.

It should have been `curl -XPOST --upload-file mapping.json http://localhost:9200/twitter/`

---

<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:** [July 5, 2017, 10:59pm UTC](https://discuss.elastic.co/t/making-an-explicit-mapping/47392/5 "2017-07-05T22:59:11Z")

</div>


