Need suggestion for mapping

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

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

analyzer

"category_id_analyzer": {
  "tokenizer": "custom_tokenizer"
}

tokenizer

"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

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