I am writing IngestPlugin, which needs to populate a timestamp (multi-field) based on fields in IngestDocument. I have defined an index as follows
{
"mappings": {
"properties": {
"field1": {
"type": "text",
"fields": {
"timestamp": {
"type": "date",
"format": "yyyy-MM-dd"
}
}
},
"field2": {
"type": "text",
"fields": {
"timestamp": {
"type": "date",
"format": "yyyy-MM-dd"
}
}
},
"field3": {
"type": "text"
}
}
},
"settings": {
"default_pipeline": "my_pipeline"
}
}
I tried to set value for "title.timestamp" using processor like this
@Override
public IngestDocument execute(IngestDocument ingestDocument) throws Exception {
ingestDocument.setFieldValue("field1.timestamp", "2020-07-27");
return ingestDocument;
}
I got the following error while inserting a document
{
"error" : {
"root_cause" : [
{
"type" : "illegal_argument_exception",
"reason" : "cannot set [timestamp] with parent object of type [java.lang.String] as part of path [field1.timestamp]"
}
],
"type" : "illegal_argument_exception",
"reason" : "cannot set [timestamp] with parent object of type [java.lang.String] as part of path [field1.timestamp]"
},
"status" : 400
}
Is there any way to populate multi-field (field1.timestamp) value on indesting document using Elasticsearch plugin?