I am using this code from the elasticsearch documentation to create an index. I should be able to paste the index configuration object from Postman in my Java code.
request.source("{\n" +
" \"settings\" : {\n" +
" \"number_of_shards\" : 1,\n" +
" \"number_of_replicas\" : 0\n" +
" },\n" +
" \"mappings\" : {\n" +
" \"properties\" : {\n" +
" \"message\" : { \"type\" : \"text\" }\n" +
" }\n" +
" },\n" +
" \"aliases\" : {\n" +
" \"twitter_alias\" : {}\n" +
" }\n" +
"}", XContentType.JSON);
When I execute GET /index_name I see an index with a weird structure containing two mappings sections. Why is this? I would expect a single mapping and a single settings section.
{
"contacts_4_3t88f9nabk": {
"aliases": {},
"mappings": {
"properties": {
"aliases": {
"properties": {
"twitter_alias": {
"type": "object"
}
}
},
"mappings": {
"properties": {
"properties": {
"properties": {
"message": {
"properties": {
"type": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
}
}
}
}
}
},
"settings": {
"properties": {
"number_of_replicas": {
"type": "long"
},
"number_of_shards": {
"type": "long"
}
}
}
}
},
"settings": {
"index": {
"creation_date": "1589442095340",
"number_of_shards": "1",
"number_of_replicas": "1",
"uuid": "othIq5Q2Sgy4eZ3xkxkneg",
"version": {
"created": "7060199"
},
"provided_name": "contacts_4_3t88f9nabk"
}
}
}
}