I'm trying to index a document in elasticsearch using the following mapping:
{"thread": {"properties":{"message":{"type": "nested", "properties": {"message_id": {"type":"string"}, "message_text":{"type":"string"}, "message_nick":{"type":"string"}}}}}}
Then using this to add the mapping in Java:
CreateIndexRequestBuilder indexRequest = client.admin().indices().prepareCreate(INDEX).addMapping("message", mapping);
But I am getting the following error:
Caused by: org.elasticsearch.index.mapper.MapperParsingException: Root type mapping not empty after parsing! Remaining fields: [mappings : {thread={properties={message={properties={message_text={type=string}, message_nick={type=string}, message_id={type=string}}, type=nested}}}}]
Can anyone let me know how I'm getting this error?