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

Aggregations fix: support include/exclude strings for IP and dates #18408

Closed
wants to merge 2 commits into from

Conversation

markharwood
Copy link
Contributor

Added calls to DocValueFormat.parse methods to handle parsing of user-supplied include and exclude strings in terms and significant_terms aggregations into a form that can be compared with doc values

Closes #17705

@jpountz
Copy link
Contributor

jpountz commented May 17, 2016

Could you also test that regexp-based filtering on ips is not supported? I think convertToStringFilter and convertToOrdinalsFilter should fail when the format is not DocValueFormat.RAW? Otherwise it looks good to me.

if ((includeExclude != null) && (includeExclude.isRegexBased()) && format != DocValueFormat.RAW) {
throw new AggregationExecutionException("Aggregation [" + name + "] cannot support regular expression style include/exclude "
+ "settings as they can only be applied to string fields. Use an array of values for include/exclude clauses");
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jpountz rather than adding a specialized test for IP field types I test for regex && format!=DocValueFormat.RAW && (valuesSource instanceof ValuesSource.Bytes)
Is this too broad?

Copy link
Contributor

Choose a reason for hiding this comment

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

This sounds right!

@jpountz
Copy link
Contributor

jpountz commented May 18, 2016

LGTM

@markharwood
Copy link
Contributor Author

Pushed in a846ff9

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.

None yet

2 participants