Avoiding repetition when defining mappings

I've got a type with many similar fields, and most of them could do quite well letting Elasticsearch apply its dynamic mapping. But let's say I'd prefer to avoid relying on the correctness of dynamic mapping. And I also wish to specify, say, a normalizer.

This can be done as:

"indexname" : {
    "mappings" : {
        "typename" : {
            "properties": {
                "fieldname1" : {
                    "type" : "text",
                    "fields": {
                        "keyword": {
                            "type": "keyword",
                            "normalizer": "my_normalizer" (defined in settings)
                        }
                    }
                }
                (and then the same 9 lines for each of fieldname2, fieldname3, etc)

Is there a way to avoid all that repetition of fieldname1's defn for fieldname2, 3, 4, etc... ? Again, other than dynamic templates.

Perhaps there's a way to define some sort of named field defn that could then be applied to numerous fields?

Seems like this would be such an obvious idea that it almost certainly does exist... but not quite obviously enough for me to find in in the Elasticsearch docs.

Thank you for any help or pointers you can provide.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.