elasticsearch/elasticsearch — Issue #1524: Default mapping means new types not mapped explicitly
Author: clintongormley
Created: 2011-12-07 20:39:55+00:00
State: open

If the `_default_` mapping for an index matches all the fields in a new type, then that new type is not explicitly mapped, which also means that a `delete_mapping` doesn't delete the docs of that type.

# [Wed Dec 7 21:38:03 2011] Protocol: http, Server: 192.168.5.10:9200
curl -XPUT 'http://127.0.0.1:9200/foo/?pretty=1' -d '
{
"mappings" : {
"_default_" : {
"properties" : {
"bar" : {
"type" : "string"
}
}
}
}
}
'

# [Wed Dec 7 21:38:03 2011] Response:
# {
# "ok" : true,
# "acknowledged" : true
# }

# [Wed Dec 7 21:38:06 2011] Protocol: http, Server: 192.168.5.10:9200
curl -XPUT 'http://127.0.0.1:9200/foo/bar/1?pretty=1' -d '
{
"bar" : "aaa"
}
'

# [Wed Dec 7 21:38:06 2011] Response:
# {
# "ok" : true,
# "_index" : "foo",
# "_id" : "1",
# "_type" : "bar",
# "_version" : 1
# }

# [Wed Dec 7 21:38:09 2011] Protocol: http, Server: 192.168.5.10:9200
curl -XGET 'http://127.0.0.1:9200/foo/_mapping?pretty=1'

# [Wed Dec 7 21:38:09 2011] Response:
# {
# "foo" : {
# "_default_" : {
# "properties" : {
# "bar" : {
# "type" : "string"
# }
# }
# }
# }
# }