work the way I'd (naively) expect them to. Neither nested or flattened field types seem to handle this correctly by default. Is there some way to associate the "Name" property as a subfield name with the corresponding "Value" in each object?
Are you saying that modifying the source document to look more like that is what would be needed? Any suggestions on an efficient way to do that at ingest time?
I think I have a solution to this that uses pipeline processors that I'll post when I've tested it properly. Your comment helped me realize I had to modify the source if I was going to get the behavior I wanted.
{
"foreach": {
"field": "o365.audit.DeviceProperties",
"processor": {
"set": {
"field": "_temp_.DeviceProperties.{{{_ingest._value.Name}}}",
"value": "{{{_ingest._value.Value}}}"
}
},
"tag": "deviceproperties-rewrite",
"ignore_failure": true,
"description": "Copies key:value pairs out of o365.audit.DeviceProperties to a temp field"
}
},
{
"remove": {
"field": "o365.audit.DeviceProperties",
"ignore_missing": true,
"tag": "deviceproperties-remove-original"
}
},
{
"rename": {
"field": "_temp_.DeviceProperties",
"target_field": "o365.audit.DeviceProperties",
"ignore_missing": true,
"tag": "deviceproperties-rename",
"description": "Copy the new key:value structure back to the original field"
}
},
This is an excerpt of the ingest pipeline that solved the issue. Just uses a foreach processor to copy all the field names and values I want to a temp field, remove the original one, and then copy the data back in the format I want to use.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.