-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
Adds ignore_unmapped
option to nested and P/C queries
#17748
Adds ignore_unmapped
option to nested and P/C queries
#17748
Conversation
fail("expected has_children query on unmapped field to fail when ignore_unmapped is false"); | ||
} catch (QueryShardException e) { | ||
assertThat(e.getMessage(), containsString("[" + HasChildQueryBuilder.NAME + "] no mapping found for type [unmapped]")); | ||
} |
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.
Can you use expectThrows
instead? I think we should use it rather than this try:fail/catch:check_msg pattern for new code.
A minor concern I have is that |
maybe we should name this setting |
I'm ok with changing it to |
|
Docs LGTM |
@@ -464,12 +502,12 @@ protected boolean doEquals(HasChildQueryBuilder that) { | |||
&& Objects.equals(scoreMode, that.scoreMode) | |||
&& Objects.equals(minChildren, that.minChildren) | |||
&& Objects.equals(maxChildren, that.maxChildren) | |||
&& Objects.equals(innerHitBuilder, that.innerHitBuilder); | |||
&& Objects.equals(innerHitBuilder, that.innerHitBuilder) && Objects.equals(ignoreUnmapped, that.ignoreUnmapped); |
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.
let's put it on the next line to be consistent?
LGTM |
The change adds a new option to the `nested`, `has_parent`, `has_children` and `parent_id` queries: `ignore_unmapped`. If this option is set to false, the `toQuery` method on the QueryBuilder will throw an exception if the type/path specified in the query is unmapped. If the option is set to true, the `toQuery` method on the QueryBuilder will return a MatchNoDocsQuery. The default value is `false`so the queries work how they do today (throwing an exception on unmapped paths/types)
ignore_unmapped
option to nested and P/C queries
The change adds a new option to the
nested
,has_parent
,has_children
andparent_id
queries:ignore_unmapped
. If this option is set to false, thetoQuery
method on the QueryBuilder will throw an exception if the type/path specified in the query is unmapped. If the option is set to true, thetoQuery
method on the QueryBuilder will return a MatchNoDocsQuery. The default value isfalse
so the queries work how they do today (throwing an exception on unmapped paths/types)