Defining a custom multilingual field

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:

   "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:

    "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?

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.

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