Hello everyone,
I'm using the dynamic mapping feature of ES while predefining the mapping of specific index which also contains a nested field and a mapping to the fields in this nested field.
When I run a bulk upsert using a script I wrote on existing document (which basically inserting the fields to the nested field) and inserts all the fields I see that fields which are not exist in the mapping of the nested field are not inserted to the document but the mapping of those new fields do get created because of the dynamic mapping. If I run the same script with the same document once again I see the new fields in the document.
Just to clarify, If this is the document that already exists in ES:
{
"field_1": true,
"nested_field": [
{
"x": "1",
"y": "2"
}
]
}
And this is the document I try to index using the script with bulk upsert:
{
"field_1": true,
"nested_field": [
{
"x": "1",
"y": "2"
"z": "3" // this field is not in the mapping of nested_field so it should get created with dynamic mapping
}
]
}
The document stays the same but the 'z' field is added to the mapping. If I try to insert it again after it got created in the mapping I do see it in the document.
Any suggestions on how to insert the field without creating a specific mapping for it?