Cannot use custom analyzer for keyword

I am trying to use a simple custom analyzer (a char filter and keyword tokeniser) to build a keyword field.

However when I specify the analyzer besides with type : "keyword", ES said not supported analyzer field.

If I switch to type : "text" , and index can be created without problem, but when index data , it complained that mapper [message.keyword] cannot be changed from type [text] to [keyword]

I am using ES 5.1.1

And following is my index setting :

{
"settings": {
"analysis": {
"analyzer": {
"log_message_keyword": {
"tokenizer": "keyword",
"char_filter": [
"strip_digits"
]
}
},
"char_filter": {
"strip_digits": {
"type": "pattern_replace",
"pattern": "(\d+)",
"replacement": "N"
}
}
}
},
"mappings": {
"log": {
"properties": {
"message": {
"type": "text",
"fields": {
"keyword": {
"type": "text",
"analyzer": "log_message_keyword",
}
}
}
}}

Take a look at normalizers

https://www.elastic.co/guide/en/elasticsearch/reference/5.5/analysis-normalizers.html#_custom_normalizers

Good point, but are this feature available for 5.1 ? I didn't see if in 5.1 doc

It was IIRC introduced in 5.2.

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