Can I set language-specific multi-fields?

Is it possible to use multi-fields to set and query multilingual fields?

Consider this mapping:

PUT multi_test
{
  "mappings": {
    "data": {
      "_field_names": {
        "enabled": false
      },
      "properties": {
        "book_title": {
          "type": "text",
          "fields": {
            "english": {
              "type": "text",
              "analyzer": "english"
            },
            "german": {
              "type": "text",
              "analyzer": "german"
            },
            "italian": {
              "type": "text",
              "analyzer": "italian"
            }
          }
        }
      }
    }
  }
}

I tried the following, but it doesn't work:

PUT multi_test/data/1
{
  "book_title.english": "It's good",
  "book_title.german": "Das gut"
}

The error seems to indicate I'm trying to add new fields:

{
"error": {
"root_cause": [
{
"type": "mapper_parsing_exception",
"reason": "Could not dynamically add mapping for field [book_title.english]. Existing mapping for [book_title] must be of type object but found [text]."
}
],
"type": "mapper_parsing_exception",
"reason": "Could not dynamically add mapping for field [book_title.english]. Existing mapping for [book_title] must be of type object but found [text]."
},
"status": 400
}

What am I doing wrong here?

If my approach is unworkable, what is a better way to do this?

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