Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Throw exception if null_value is set to `null` #7978

Closed

Conversation

Projects
None yet
4 participants
@polyfractal
Copy link
Member

polyfractal commented Oct 3, 2014

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

Fixes #7273

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.

@rjernst

This comment has been minimized.

Copy link
Member

rjernst commented Oct 3, 2014

LGTM.

@s1monw

This comment has been minimized.

Copy link
Contributor

s1monw commented Oct 6, 2014

LGTM

@s1monw

This comment has been minimized.

Copy link
Contributor

s1monw commented Oct 6, 2014

I think this should go into 1.3 and 1.4 et.al - I labeled the issues accordingly

@s1monw s1monw removed review >bug labels Oct 6, 2014

@polyfractal

This comment has been minimized.

Copy link
Member Author

polyfractal commented Oct 10, 2014

Merged in master: 4e2dd77, 1.x: fcea4c5, 1.4: 4b5b01f, 1.3: 49374db

@clintongormley clintongormley changed the title Mapper: Throw exception if null_value is set to null Mapping: Throw exception if null_value is set to null Nov 3, 2014

@clintongormley clintongormley changed the title Mapping: Throw exception if null_value is set to null Throw exception if null_value is set to `null` Jun 7, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.