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

Standardize script field's rejection error #60029

Conversation

nik9000
Copy link
Member

@nik9000 nik9000 commented Jul 21, 2020

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.

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.
@nik9000 nik9000 added the :Search/Search Search-related issues that do not fall into other categories label Jul 21, 2020
@nik9000 nik9000 requested a review from javanna July 21, 2020 23:10
@javanna javanna mentioned this pull request Jul 21, 2020
30 tasks
Copy link
Member

@javanna javanna left a 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() + "]"
Copy link
Member

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. ?

Copy link
Member Author

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() + "]";
Copy link
Member

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

Copy link
Member

@javanna javanna left a 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

@nik9000 nik9000 merged commit 9a3fa42 into elastic:feature/runtime_fields Jul 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Search/Search Search-related issues that do not fall into other categories
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants