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

**URL:** <https://discuss.elastic.co/t/is-it-impossible-to-use-multi-fields-mapping-without-default-type/250953>\
**Category:** Elasticsearch\
**Created:** [October 5, 2020, 9:08am UTC](https://discuss.elastic.co/t/is-it-impossible-to-use-multi-fields-mapping-without-default-type/250953 "2020-10-05T09:08:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![taichi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/taichi/32/46431_2.png) [@taichi](https://discuss.elastic.co/u/taichi)\
**Post date:** [October 5, 2020, 9:08am UTC](https://discuss.elastic.co/t/is-it-impossible-to-use-multi-fields-mapping-without-default-type/250953/1 "2020-10-05T09:08:14Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [October 5, 2020, 9:45am UTC](https://discuss.elastic.co/t/is-it-impossible-to-use-multi-fields-mapping-without-default-type/250953/2 "2020-10-05T09:45:25Z")

</div>

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.

---

<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:** [November 2, 2020, 9:45am UTC](https://discuss.elastic.co/t/is-it-impossible-to-use-multi-fields-mapping-without-default-type/250953/3 "2020-11-02T09:45:31Z")

</div>

Closed on November 2, 2020, 9:45am UTC

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