I would do that in ruby. This is an example of flattening objects. This is an example of stripping a prefix from a field name.
You might want to use something like
newK = k.sub(/\.([^.]*$)/, "\1")
© 2020. All Rights Reserved - Elasticsearch
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.