-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Description
Elasticsearch version: 5.3.0
Plugins installed: []
JVM version: 1.8.0.92
OS version: SLES11SP4
Description of the problem including expected versus actual behavior:
When creating a dynamic template, a user can provide an invalid value to the "index" parameter (true/false instead of "analzyed","not_analyzed"). ElasticSearch accepts the template and does not warn about the invalid value, but any documents that will match this template will be discarded.
ElasticSearch should validate the template and reject it if it's malformed.
Steps to reproduce:
- Create a dynamic template as follows
{
"string_fields": {
"mapping": {
"index": true,
"type": "text",
"fields": {
"raw": {
"ignore_above": 10000,
"index": "not_analyzed",
"type": "keyword"
}
}
},
"match_mapping_type": "string",
"match": "*"
}
} - Index any document with a string field
- The following exception will appear in the log:
java.lang.IllegalArgumentException: Can't parse [index] value [true] for field [YOUR_FIELD_NAME_HERE], expected [no], [not_analyzed] or [analyzed]
at org.elasticsearch.index.mapper.StringFieldMapper$TypeParser.parse(StringFieldMapper.java:210) ~[elasticsearch-5.3.0.jar:5.3.0]