Skip to content

Conversation

@polyfractal
Copy link
Contributor

Adds proper validation of the settings passed to a moving average model. You will now get an exception if you try to pass an unknown, non-whitelisted parameter to a model, instead of silently dropping it on the floor.

The only point of contention is that I added a settings() method to the MovingAvgBuilder, so that this could be tested, and perhaps allow users to specify all the parameters in one pass. This is opposed to specifying all the parameters on the model builder itself, which only allows you to specify applicable params.

So on one hand the settings() param more closely mimics the REST api and allows convenience, on the other hand it provides a small foot gun.

@colings86 If you could take a peek at this when you get time, it'd be swell. No rush, pretty low priority ❤️

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be a ParseException instead of an IllegalArgumentException. This would be in line with what we do elsewhere in the codebase (such as in the mapper parsers where any left over parameters after parsing is done are throw in a MapperParsingException).

@colings86
Copy link
Contributor

@polyfractal left a small comment but otherwise it looks good

@polyfractal polyfractal force-pushed the bugfix/movavg_validation branch 2 times, most recently from 6846231 to 66b5f4e Compare July 16, 2015 15:39
@polyfractal polyfractal force-pushed the bugfix/movavg_validation branch from 66b5f4e to 702f884 Compare July 16, 2015 15:41
polyfractal added a commit that referenced this pull request Jul 16, 2015
Aggregations: Add better validation of moving_avg model settings
@polyfractal polyfractal merged commit 380648a into elastic:master Jul 16, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants