# Defining a custom multilingual field

**URL:** <https://discuss.elastic.co/t/defining-a-custom-multilingual-field/131631>\
**Category:** Elasticsearch\
**Created:** [May 13, 2018, 5:11pm UTC](https://discuss.elastic.co/t/defining-a-custom-multilingual-field/131631 "2018-05-13T17:11:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![infojunkie](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/infojunkie/32/31148_2.png) [@infojunkie](https://discuss.elastic.co/u/infojunkie)\
**Post date:** [May 13, 2018, 5:11pm UTC](https://discuss.elastic.co/t/defining-a-custom-multilingual-field/131631/1 "2018-05-13T17:11:58Z")

</div>

I'd like to create an index with multiple multilingual fields. Each field would allow representing the same text clause in multiple languages, using a structure like the following:

```auto
   "clause" : {
     "properties": {
        "en": {
             "type": "text",
             "analyzer": "english"
        },
        "fr": {
             "type": "text",
             "analyzer": "french"
        },
        [...]
     }
   }

```

My question: instead of rewriting this long field structure for each needed field, I'd like to write a mapper plugin that would allow me to declare the mapping as:

```auto
    "clause": {
        "type": "multilingual"
   }

```

Is this within the realm of possibilities for mapper plugins? As an Elasticsearch n00b, is there a place that would show the basic structure for such a plugin?

---

<div class="post-metadata">

**Author:** ![rjernst](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rjernst/32/6363_2.png) [@rjernst](https://discuss.elastic.co/u/rjernst)\
**Post date:** [May 20, 2018, 9:38pm UTC](https://discuss.elastic.co/t/defining-a-custom-multilingual-field/131631/2 "2018-05-20T21:38:23Z")

</div>

This is not generally possible, but it is not because of Elasticsearch. Lucene analyzers are used at both indexing and query time. While indexing often has enough data (depending on the field) to determine the relevant language to analyze, querying most of the time does not.

---

<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:** [June 17, 2018, 9:38pm UTC](https://discuss.elastic.co/t/defining-a-custom-multilingual-field/131631/3 "2018-06-17T21:38:25Z")

</div>

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