I have an alias on two very large indices that have many common properties. The property names on the indices have however different naming conventions. For example:
"index1" : {
"mappings" : {
"X" : {
"properties" : {
"REGISTRATION_DATE" : {
"type" : "date"
}
}
}
}
"index2" : {
"mappings" : {
"Y" : {
"properties" : {
"RegistrationDate" : {
"type" : "date"
}
}
}
}
What I want to do is use Elastic NEST's attribute mapping to map these two properties to the same POCO property without having to rename either of the property names on the indices.
So the attribute mapping would look something like this:
public sealed class MyObject
{
[Date(Name = "REGISTRATION_DATE")]
[Date(Name = "RegistrationDate")]
public string RegistrationDate { get; set; }
}
This does not seem to be possible with attribute mapping, even with creating a custom multi attribute.
Is there another way to do this using NEST's mapping?
Note: I have put an field alias on one of the properties in order for searching and sorting to work using the index alias. That however does not help with the mapping, as GET requests only return the document source untouched.
PUT index2/_mapping/Y
{
"properties": {
"REGISTRATION_DATE": {
"type": "alias",
"path": "RegistrationDate"
}
}
}