# Need suggestion for mapping

**URL:** <https://discuss.elastic.co/t/need-suggestion-for-mapping/255281>\
**Category:** Elasticsearch\
**Created:** [November 13, 2020, 3:03am UTC](https://discuss.elastic.co/t/need-suggestion-for-mapping/255281 "2020-11-13T03:03:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![amanjain](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/amanjain/32/46385_2.png) [@amanjain](https://discuss.elastic.co/u/amanjain)\
**Post date:** [November 13, 2020, 3:03am UTC](https://discuss.elastic.co/t/need-suggestion-for-mapping/255281/1 "2020-11-13T03:03:12Z")

</div>

Hi

I am using category, which is a hierarchical field represented as `level1>level2>level3>level4`  
I want to make a query that can apply filter on `level2` or `level3` individually. So, I am using `simple_pattern_split` tokenizer and mapping looks like this

```auto
"category_id": {
  "type": "text",
  "analyzer": "category_id_analyzer",
  "search_analyzer": "category_id_analyzer"
},

```

analyzer

```auto
"category_id_analyzer": {
  "tokenizer": "custom_tokenizer"
}

```

tokenizer

```auto
"custom_tokenizer": {
  "type": "simple_pattern_split",
  "pattern": ">"
}

```

But, I also want to perform aggregations on each individual category which can only be done if `type: keyword` but it gives error  
`Mapping definition for [category_id] has unsupported parameters: [search_analyzer : category_id_analyzer] [analyzer : category_id_analyzer]`

Can someone suggest what should be done ?  
Thanks

---

<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:** [December 11, 2020, 3:03am UTC](https://discuss.elastic.co/t/need-suggestion-for-mapping/255281/2 "2020-12-11T03:03:29Z")

</div>

Closed on December 11, 2020, 3:03am UTC

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