elasticsearch/elasticsearch — pull request #7978 by polyfractal (2014-10-03 16:22:10+00:00)
Title: Mapper: Throw exception if null_value is set to null

The mapping parser should throw an exception if "null_value" is set to `null`.

Fixes #7273

```bash
PUT /foo
{
"mappings": {
"bar": {
"properties": {
"exception": {
"null_value": null,
"type": "integer"
}
}
}
}
}
```
```
{
"error": "MapperParsingException[mapping [bar]]; nested: MapperParsingException[Property [null_value] cannot be null.]; ",
"status": 400
}
```

As a side note, looks like there are a lot of other properties which could be set to null and throw similar errors: https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/index/mapper/core/TypeParsers.java#L146-L187

I'm not sure the best way to handle these other than an explicit check for nullness inside each clause...which seems gross.