I'm trying to disable date_detection on a set of fields in an index. Below is the mapping
{
"my-index" : {
"mappings" : {
"properties" : {
"_class" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
},
"customFields" : {
"properties" : {
"firstName" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
},
"lastName" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
},
"address" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
},
"dateOfBirth" : {
"type" : "date"
}
}
},
"key" : {
"type" : "long"
},
"updatedDate" : {
"type" : "date",
"format" : "basic_date_time"
}
}
}
}
}
I want the dateOfBirth field to be of type text, not date.
So I did the following:
I created a mappings.json file (see below) and used the @Mapping(mappingPath = "mappings.json") annotation
{
"date_detection": false
}
Now, this does disable date_detection but it also forces the updatedDate to be of type text and this is causing some errors.
These are the updatedDate and customFields variables in my index class:
@Field(type = FieldType.Date, format = DateFormat.basic_date_time)
Instant updatedDate;
Map<String, Object> customFields;
Is there a way to disable date_detection for the fields inside customFields so that only the dateOfBirth field's type is changed to text and not updatedDate?