-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
When using multifield mapping the domain-object will not be the same as before posted to server.
I adding a field with 3 variants (default + 2 not default)
{
"mappings": {
"da4d54ec38b0413c96bf94f3b4280265": {
"properties": {
"name": {
"type": "multi_field",
"fields": {
"name": {
"type": "string",
"store": true,
"index": "not_analyzed",
"term_vector": "no"
},
"name_analyzed": {
"type": "string",
"store": false,
"index": "analyzed",
"term_vector": "no"
},
"name_notanalyzed": {
"type": "string",
"store": false,
"index": "not_analyzed",
"term_vector": "no"
}
}
}
}
}
}
}
When I request to get the mapping from ES I will got a JSON like this back where the type are "string" and the multi-field that have the same name as the field are exposed directly on the field-node.
{
"e607244a-e95d-411e-9f7c-f78fd10ec3da" : {
"mappings" : {
"da4d54ec38b0413c96bf94f3b4280265" : {
"properties" : {
"name" : {
"type" : "string",
"index" : "not_analyzed",
"store" : true,
"fields" : {
"name_notanalyzed" : {
"type" : "string",
"index" : "not_analyzed"
},
"name_analyzed" : {
"type" : "string"
}
}
}
}
}
}
}
}
When this is parsed back to domain-object the response-converter are creating a MultiFieldMapping that have type as "string" and correct name but other attributes like index/store/etc on the field are missing.
When I later update the mappings I got the following request (and missing the index/store attributes). Don't know if it have any negative impact that the attributes are missing.
{
"elasticsearchprojects": {
"properties": {
"name": {
"type": "string",
"fields": {
"name_notanalyzed": {
"type": "string",
"index": "not_analyzed"
},
"name_analyzed": {
"type": "string"
}
}
}
}
}
}
This is not consequent between how the domain-object are used when creating the mapping and after fetching the mapping. Needing 2 different code to handle the mappings, one for creating and one for validating and updating mapping.