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

"did you mean" for ObjectParser with top named #51018

Merged
merged 3 commits into from
Jan 17, 2020

Conversation

nik9000
Copy link
Member

@nik9000 nik9000 commented Jan 15, 2020

When you declare an ObjectParser with top level named objects like we do
with significant_terms we didn't support "did you mean". This fixes
that.

Relates #50938

When you declare an ObjectParser with top level named objects like we do
with `significant_terms` we didn't support "did you mean". This fixes
that.

Relates elastic#50938
}
if (false == entry.name.match(name, parser.getDeprecationHandler())) {
/* Note that this shouldn't happen because we already looked up the entry using the names but we need to call `match` anyway
* because it is responsible for logging deprecation warnings. */
throw new NamedObjectNotFoundException(parser.getTokenLocation(),
throw new XContentParseException(parser.getTokenLocation(),
Copy link
Member Author

Choose a reason for hiding this comment

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

All of the exceptions that I changed to XContentParseException are really more development errors than usage errors.

Copy link
Member Author

Choose a reason for hiding this comment

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

And they don't have the critical candidates set.

@polyfractal polyfractal added v7.7.0 and removed v7.6.0 labels Jan 15, 2020
@nik9000 nik9000 added :Core/Infra/Core Core issues without another label and removed WIP labels Jan 15, 2020
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra (:Core/Infra/Core)

Copy link
Contributor

@romseygeek romseygeek left a comment

Choose a reason for hiding this comment

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

LGTM. Looking at other places that NamedObjectNotFoundException is used in the code, does this mean that we can rewrite AbstractQueryBuilder.parseInnerQueryBuilder to use an ObjectParser and get 'did you mean' suggestions for misspelt queries?

@nik9000
Copy link
Member Author

nik9000 commented Jan 16, 2020

Looking at other places that NamedObjectNotFoundException is used in the code, does this mean that we can rewrite AbstractQueryBuilder.parseInnerQueryBuilder to use an ObjectParser and get 'did you mean' suggestions for misspelt queries?

I believe so.

@nik9000
Copy link
Member Author

nik9000 commented Jan 16, 2020

I believe so.

I think we'd more likely want to port the SearchSourceBuilder's parsers to ObjectParser and have the query field use named x content. So long as that works we can avoid needing that method entirely.

@nik9000 nik9000 merged commit 224640a into elastic:master Jan 17, 2020
nik9000 added a commit to nik9000/elasticsearch that referenced this pull request Jan 17, 2020
When you declare an ObjectParser with top level named objects like we do
with `significant_terms` we didn't support "did you mean". This fixes
that.

Relates elastic#50938
nik9000 added a commit that referenced this pull request Jan 17, 2020
When you declare an ObjectParser with top level named objects like we do
with `significant_terms` we didn't support "did you mean". This fixes
that.

Relates #50938
SivagurunathanV pushed a commit to SivagurunathanV/elasticsearch that referenced this pull request Jan 23, 2020
When you declare an ObjectParser with top level named objects like we do
with `significant_terms` we didn't support "did you mean". This fixes
that.

Relates elastic#50938
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants