Put a mapping using java api not working

hi,

can you quickly spot any errors in my code? it fails with root type not
empty

XContentBuilder mapping = null;
    try {
        mapping = jsonBuilder()
                .startObject()
                .startObject("message")
                .startObject("_parent")
                .field("type", "chat")
                .endObject()
                .endObject()
                .endObject();
    } catch (IOException e) {
        e.printStackTrace();
    }

    PutMappingResponse putMappingResponse = client.admin().indices()
            .preparePutMapping("messages")
            .setType("chat")
            .setSource(mapping)
            .execute().actionGet();
}

messages=index
chat=parent document
message=child document

error = Root type mapping not empty after parsing! Remaining fields:
[message : {_parent={type=chat}}]

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/fae56ba3-6bac-418d-8075-eafba49f5a28%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.