-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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
Rename rule query and add support for multiple rulesets #108831
Conversation
Documentation preview: |
Hi @kderusso, I've created a changelog YAML for you. |
...ck/plugin/ent-search/src/main/java/org/elasticsearch/xpack/application/EnterpriseSearch.java
Outdated
Show resolved
Hide resolved
} | ||
|
||
private static final ConstructingObjectParser<RuleQueryBuilder, Void> PARSER = new ConstructingObjectParser<>(NAME, a -> { | ||
QueryBuilder organicQuery = (QueryBuilder) a[0]; | ||
@SuppressWarnings("unchecked") | ||
Map<String, Object> matchCriteria = (Map<String, Object>) a[1]; | ||
String rulesetId = (String) a[2]; | ||
return new RuleQueryBuilder(organicQuery, matchCriteria, rulesetId); | ||
@SuppressWarnings("unchecked") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As specified, this allows legacy ruleset_id
queries to continue to work.
Pinging @elastic/search-relevance (Team:Search - Relevance) |
Pinging @elastic/ent-search-eng (Team:SearchOrg) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great overall. 2 small comments.
...gin/ent-search/src/main/java/org/elasticsearch/xpack/application/rules/RuleQueryBuilder.java
Outdated
Show resolved
Hide resolved
...ck/plugin/ent-search/src/main/java/org/elasticsearch/xpack/application/EnterpriseSearch.java
Outdated
Show resolved
Hide resolved
throw new IllegalArgumentException("rulesetIds must not be null or empty"); | ||
} | ||
|
||
if (rulesetIds.size() > MAX_NUM_RULESETS) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
completely unrelated to your changes, I do wonder if there are other places we make these types of validations, like maximum number of elements, checking for empty arrays or for null
values in arrays - maybe these could be part of PARSER.declareStringArray
? WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do like having the Exceptions in the constructor for testing purposes, but we can certainly look at standardizing these errors more. I'd like to keep that in a separate tech debt/cleanup initiative if you're OK with that though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks good - I had one comment about a missing test #108831 (comment) that you could add before merging the PR
@elasticmachine update branch |
This PR renames
rule_query
torule
and adds support for multiple specifiedruleset_ids
. Existingrule_query
andruleset_id
syntax will work for now but will be removed in a future release.PR includes some tech debt, removing unused fields from the
RuleQueryBuilder
to avoid cleanup in a subequent transport version change.Example of the updated rule query syntax: