# Unnamed mapping for PUT

**URL:** <https://discuss.elastic.co/t/unnamed-mapping-for-put/24969>\
**Category:** Elasticsearch\
**Created:** [July 6, 2015, 5:44pm UTC](https://discuss.elastic.co/t/unnamed-mapping-for-put/24969 "2015-07-06T17:44:30Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![daver208](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/daver208/32/3586_2.png) [@daver208](https://discuss.elastic.co/u/daver208)\
**Post date:** [July 6, 2015, 5:44pm UTC](https://discuss.elastic.co/t/unnamed-mapping-for-put/24969/1 "2015-07-06T17:44:30Z")

</div>

The mapping documentation states that the following code will create a `tweet` type on the twitter index with the specified mapping

```auto
$ curl -XPUT 'http://localhost:9200/twitter/_mapping/tweet' -d '
{
    "tweet" : {
        "properties" : {
            "message" : {"type" : "string", "store" : true }
        }
    }
}
'

```

[https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-put-mapping.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-put-mapping.html)

The following also appears to work:

```auto

$ curl -XPUT 'http://localhost:9200/twitter/_mapping/tweet' -d '
{
   "properties" : {
       "message" : {"type" : "string", "store" : true }
  }
}

```

Is this behavior by design? It doesn't appear to be documented that you can just send the mapping without having a property name matching the type. We are currently using this behavior, but we'd like to be able to count on its existence in the future. If this is not by design, feedback would be appreciated.

---

<div class="post-metadata">

**Author:** ![daver208](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/daver208/32/3586_2.png) [@daver208](https://discuss.elastic.co/u/daver208)\
**Post date:** [July 6, 2015, 5:55pm UTC](https://discuss.elastic.co/t/unnamed-mapping-for-put/24969/2 "2015-07-06T17:55:19Z")

</div>

Also note that the following works:

```auto

$ curl -XPUT 'http://localhost:9200/twitter/tweet/_mapping' -d '
{
   "properties" : {
       "message" : {"type" : "string", "store" : true }
  }
}
'

```

---

<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:** [July 6, 2015, 9:05pm UTC](https://discuss.elastic.co/t/unnamed-mapping-for-put/24969/3 "2015-07-06T21:05:55Z")

</div>

Unless my eyes deceive me, these are the same? (The first two that is)

---

<div class="post-metadata">

**Author:** ![daver208](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/daver208/32/3586_2.png) [@daver208](https://discuss.elastic.co/u/daver208)\
**Post date:** [July 6, 2015, 9:11pm UTC](https://discuss.elastic.co/t/unnamed-mapping-for-put/24969/4 "2015-07-06T21:11:31Z")

</div>

Note that the second example doesn't have a named property of `tweet` in the object being PUT

---

<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:** [July 6, 2015, 11:09pm UTC](https://discuss.elastic.co/t/unnamed-mapping-for-put/24969/5 "2015-07-06T23:09:33Z")

</div>

Ahh you're right, early morning blunder 😉

---

<div class="post-metadata">

**Author:** ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)\
**Post date:** [July 6, 2015, 11:31pm UTC](https://discuss.elastic.co/t/unnamed-mapping-for-put/24969/6 "2015-07-06T23:31:43Z")

</div>

Sending invalid json isn't always guaranteed to work. It does now sometimes  
like you saw. Not sure about the mapping with and without the name.  
Personally I'd like only the without form to work when you've already put  
it in the path but I don't know what the long term plan is.

---

<div class="post-metadata">

**Author:** ![daver208](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/daver208/32/3586_2.png) [@daver208](https://discuss.elastic.co/u/daver208)\
**Post date:** [July 7, 2015, 1:40pm UTC](https://discuss.elastic.co/t/unnamed-mapping-for-put/24969/7 "2015-07-07T13:40:02Z")

</div>

> Personally I'd like only the without form to work when you've already put it in the path but I don't know what the long term plan is.

Yeah this is what I was hoping for as well, since the type is in the URL. This is also useful if you have multiple types that use the same mapping. I think we could set something up that uses a default template, but I like how explicit the above is.

---

<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 6, 2017, 12:03am UTC](https://discuss.elastic.co/t/unnamed-mapping-for-put/24969/8 "2017-07-06T00:03:12Z")

</div>


