# Avoiding repetition when defining mappings

**URL:** <https://discuss.elastic.co/t/avoiding-repetition-when-defining-mappings/105315>\
**Category:** Elasticsearch\
**Created:** [October 26, 2017, 12:20am UTC](https://discuss.elastic.co/t/avoiding-repetition-when-defining-mappings/105315 "2017-10-26T00:20:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rretter](https://avatars.discourse-cdn.com/v4/letter/r/848f3c/32.png) [@rretter](https://discuss.elastic.co/u/rretter)\
**Post date:** [October 26, 2017, 12:20am UTC](https://discuss.elastic.co/t/avoiding-repetition-when-defining-mappings/105315/1 "2017-10-26T00:20:53Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [November 23, 2017, 12:20am UTC](https://discuss.elastic.co/t/avoiding-repetition-when-defining-mappings/105315/2 "2017-11-23T00:20:54Z")

</div>

Closed on November 23, 2017, 12:20am UTC

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