I am trying to add a custom analyzer to elasticsearch in order to use it as the default analyzer in the index template. So far, I could have made it work when explicitly defined as an analyzer for a property (if it is defined inside a template), but not when trying to use it by default. Here is what I still have:
Added to elasticsearch.yml:
index:
analysis:
analyzer:
custom_whitespace:
type: standard
tokenizer: whitespace
filter: [lowercase]
Elasticsearch starts without errors, but when I try to use a template to create an index, for example:
{
"aliases": {},
"order": 0,
"settings": {
"index.analysis.analyzer.default.stopwords": "_none_",
"index.analysis.analyzer.default.type": "custom_whitespace",
"index.refresh_interval": "5s"
},
"template": "goldstone-*",
"mappings": {
"_default_": {
"_timestamp": {
"enabled": true,
"path": "@timestamp"
},
"_source": {
"enabled": true
},
"properties": {
"@timestamp": {
"type": "date"
}
}
}
}
}
When creating an index, an error occurs:
IndexCreationException[[goldstone-2014.05.05] failed to create index]; nested: ElasticsearchIllegalArgumentException[failed to find analyzer type [custom_whitespace] or tokenizer for [default]]; nested: NoClassSettingsException[Failed to load class setting [type] with value [custom_whitespace]]; nested: ClassNotFoundException[org.elasticsearch.index.analysis.customwhitespace.CustomWhitespaceAnalyzerProvider]
, , , , index.analysis.analyzer.default.type ", . :
{
"aliases": {},
"order": 0,
"settings": {
"analysis": {
"analyzer": {
"custom_whitespace": {
"filter": ["lowercase"],
"tokenizer": "whitespace"
}
}
},
"index.analysis.analyzer.default.stopwords": "_none_",
"index.analysis.analyzer.default.type": "whitespace",
"index.refresh_interval": "5s"
},
"template": "goldstone-*",
"mappings": {
"keystone_service_list": {
"_timestamp": {
"enabled": true,
"path": "@timestamp"
},
"_source": {
"enabled": true
},
"properties": {
"@timestamp": {
"type": "date"
},
"region": {
"type": "string",
"analyzer": "custom_whitespace"
}
}
}
}
}
, ?