How to map document field which can be a number OR string OR nested object?

I index exception messages and among other fields there a a couple ("Code",
"Status") which used to be numbers, so default dynamic mapping happily
mapped them as integers.

Then after some time it appeared that those fields are not necessarily
integers, they can be strings. When this happens default dynamic mapping
complains.So I have added the following mapping to force all suspicious
fields to be strings, rather than integers:

{
"dynTemplate_ForcedStrings":
{
"match": "(?i)
application|domain|file|HttpStatusCode|type|message|messageTemplate|
ErrorCode
|code|Status|ClassName|ExceptionMethod|Source|Zone|StackTraceString|0|1|2|3|4|5|6|7|8|9",
"match_pattern": "regex",
"mapping":
{
"type" : "string",
"fields": {
"raw": { "type": "string", "index": "not_analyzed" }
}
}
}
},

But now the problem become worse again - in some cases those fields are not
even strings! Looking at incoming JSON - they are nested objects!

Well, I don't really care to parse them as nested objects. I only want
mapper not to blow up when it encounters one of those "can be anything"
fields. How to I configure that?

In the worst case - how can I completely ignore those fields to avoid
mapper failures?
But hopefully there is a way to store those fields somehow.

Any advice?

Thank you!
Konstantin

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/ea229d82-eb52-4815-a68e-aa42054376ef%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.