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",
}
}
}
}}