Is it impossible to use multi-fields mapping without default type?

I want to use fields named foo.ngram & foo.kuromoji (kuromoji is Japanese morphological analyzer).

Setting like below does not work, saying No type specified for field [foo].

{
    "mapping": {
        "properties": {
            "foo": {
                "fields": {
                    "ngram": {
                        "type": "text",
                        "analyzer": "ngram_analyzer"
                    },
                    "kuromoji": {
                        "type": "text",
                        "analyzer": "kuromoji_analyzer"
                    }
                }
            }
        }
    }
}

It seems I must set default type and analyzer to foo like this:

{
    "mapping": {
        "properties": {
            "foo": {
                "fields": {
                    "type": "text",
                    "analyzer": "kuromoji_analyzer",
                    "ngram": {
                        "type": "text",
                        "analyzer": "ngram_analyzer"
                    }
                }
            }
        }
    }
}

But I prefer the first one. Is there any way to do it?

Hey,

so you always need to have a default field mapping for the foo field itself, you cannot have foo.ngram and foo.kuromoji without having a mapping for foo as well.

1 Like

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