Doubts about Multifields

Hi!
Can anyone tell me if using the multifields strategy (strategy A) would be better than individually separating (strategy B) each field? What would be the advantages between one and the other?

Strategy A

{
  "title": {
    "type": "text",
    "fields": {
      "pt-br": {
        "type": "text",
        "analyzer": "brazilian"
      },
      "en": {
        "type": "text",
        "analyzer": "english"
      }
    }
  }
}

Strategy B

{
  "title_pt-br": {
    "type": "text",
    "analyzer": "brazilian"
  },
  "title_en": {
    "type": "text",
    "analyzer": "english"
  }
}

From a storage perspective B would be better if the indexing client knows what language the doc uses and only sends one of the two possible values.

Option A works better if the indexing client doesn’t know the language of the doc so it is indexed 2 ways (note the root ‘title’ in your example will also be indexed using the default ‘standard’ analyzer so this 3rd way may be a waste)

2 Likes

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