-
Notifications
You must be signed in to change notification settings - Fork 24.8k
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
Standardize script field's rejection error #60029
Standardize script field's rejection error #60029
Conversation
This standardizes the exception type thrown when attempting to build a query on a script field that it doesn't support. It also replaces the field type `[script]` in the error message with whatever the runtime type is.
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.
left one comment, LGTM otherwise
QueryShardContext context | ||
) { | ||
throw new IllegalArgumentException( | ||
"Can only use regexp queries on keyword and text fields - not on [" + name() + "] which is of type [" + runtimeType() + "]" |
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.
To be more accurate, the field is of type script and its runtime_type is keyword, long etc. Can we expand and say it is a script field with runtime_type etc. ?
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.
👍
} | ||
|
||
private String unsupported(String query, String supported) { | ||
String thisField = "[" + name() + "] which is of type [script] with runtime_type [" + runtimeType() + "]"; |
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.
don't hardcode script :) we are going to rename it and if you use the existing constant renaming will be easier
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.
LGTM besides the minor comment I left
This standardizes the exception type thrown when attempting to build a
query on a script field that it doesn't support. It also replaces the
field type
[script]
in the error message with whatever the runtime typeis.