Skip to content

Conversation

@colings86
Copy link
Contributor

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 falseso the queries work how they do today (throwing an exception on unmapped paths/types)

Copy link
Contributor

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.

@jpountz
Copy link
Contributor

jpountz commented Apr 14, 2016

A minor concern I have is that ignore_unmapped: false is a double negation, which could get confusing. Otherwise the change looks good and well tested.

@martijnvg
Copy link
Member

maybe we should name this setting fail_unmapped? (and then default to true)

@colings86
Copy link
Contributor Author

I'm ok with changing it to fail_unmapped although we seem to use ignore_* elsewhere in the api including ignore_malformed which is a bit of a double negation too. What do you think @jpountz and @clintongormley ?

@clintongormley
Copy link
Contributor

ignore_unmapped defaults to false, so the only time the user will use this will be to set ignore_unmapped: true, which I think is OK.

@clintongormley
Copy link
Contributor

Docs LGTM

Copy link
Contributor

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?

@jpountz
Copy link
Contributor

jpountz commented Apr 14, 2016

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)
@colings86 colings86 merged commit 686aff1 into elastic:master Apr 14, 2016
@colings86 colings86 deleted the enhance/ignoreUnmappedNestedPC branch April 14, 2016 09:38
This was referenced Apr 14, 2016
@clintongormley clintongormley changed the title Adds ignore_unmapped option to nested and P/C queries Adds ignore_unmapped option to nested and P/C queries May 2, 2016
russcam added a commit to elastic/elasticsearch-net that referenced this pull request Jun 14, 2016
russcam added a commit to elastic/elasticsearch-net that referenced this pull request Jun 16, 2016
@clintongormley clintongormley added :Search/Search Search-related issues that do not fall into other categories and removed :Query DSL labels Feb 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

>enhancement :Search/Search Search-related issues that do not fall into other categories v5.0.0-alpha2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants