Flatten nested fields in a json object

Hi,

we are having this issue with Kibana not displaying fields from nested objects correctly.
I've opened a topic in the Kibana discuss board, but eventually got to the understanding that this is a known and pending issue, as you can see in the mentioned thread:

so until this is resolved if at all, i'm looking for a way to work around it using logstash.
I am sending json documents to ES with several levels of fields\objects.
so I guess that I need to flatten those in logstash, so that a field that looks like this for example:

"body": {
  "message": {
	"message": {
	  "mimeType": "text/plain"
	}
  }
}

will become the following string:

body.message.message.mimeType

any ideas?

thanks,