Hi All,
I am trying to creating a mapping with aliases that involve mapping to a multifield property. However, I am running into errors. I have read the docs on the alias datatype, however I don't think it is clear enough to determine whether what I am trying to do is allowed.
Below is a snippet of what I am trying to do.
"properties": {
"userId": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword"
}
}
},
"deviceUsername": {
"type": "alias",
"path": "userId",
"fields": {
"keyword": {
"type": "alias",
"path": "userId.keyword"
}
}
}
}
This results in the following error:
{
"error": {
"root_cause": [
{
"type": "mapper_parsing_exception",
"reason": "Mapping definition for [deviceUsername] has unsupported parameters: [fields : {keyword={path=userId.keyword, type=alias}}]"
}
],
"type": "mapper_parsing_exception",
"reason": "Failed to parse mapping [_doc]: Mapping definition for [deviceUsername] has unsupported parameters: [fields : {keyword={path=userId.keyword, type=alias}}]",
"caused_by": {
"type": "mapper_parsing_exception",
"reason": "Mapping definition for [deviceUsername] has unsupported parameters: [fields : {keyword={path=userId.keyword, type=alias}}]"
}
},
"status": 400
}
I have also tried the following:
"properties": {
"userId": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword"
}
}
},
"deviceUsername": {
"type": "alias",
"path": "userId"
},
"deviceUsername.keyword": {
"type": "alias",
"path": "userId.keyword"
}
}
This results in the error:
{
"error": {
"root_cause": [
{
"type": "mapper_parsing_exception",
"reason": "Failed to parse mapping [_doc]: Cannot merge a field alias mapping [deviceUsername] with a mapping that is not for a field alias."
}
],
"type": "mapper_parsing_exception",
"reason": "Failed to parse mapping [_doc]: Cannot merge a field alias mapping [deviceUsername] with a mapping that is not for a field alias.",
"caused_by": {
"type": "illegal_argument_exception",
"reason": "Cannot merge a field alias mapping [deviceUsername] with a mapping that is not for a field alias."
}
},
"status": 400
}
Is there a way to achieve what I am trying to do, or is this not possible?