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

Add runtime_script date field #60092

Merged
merged 3 commits into from
Jul 29, 2020

Conversation

nik9000
Copy link
Member

@nik9000 nik9000 commented Jul 22, 2020

Adds support for runtime_script fields with runtime_type: date.
Doesn't add support for the format parameter to the mapper but does
support it on aggregations and the like. Its a start!

Adds support for `runtime_script` fields with `runtime_type: date`.
Doesn't add support for the `format` parameter to the mapper but *does*
support it on aggregations and the like. Its a start!
@nik9000 nik9000 added the :Search/Search Search-related issues that do not fall into other categories label Jul 22, 2020
@nik9000 nik9000 requested a review from javanna July 22, 2020 21:00
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-search (:Search/Search)

@elasticmachine elasticmachine added the Team:Search Meta label for search team label Jul 22, 2020
@javanna javanna mentioned this pull request Jul 23, 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 a couple of comments, LGTM otherwise

@@ -210,6 +210,7 @@ private AbstractDistanceScoreFunction parseVariable(String fieldName, XContentPa

// dates and time and geo need special handling
parser.nextToken();
// TODO these ain't gonna work with runtime fields
Copy link
Member

Choose a reason for hiding this comment

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

interesting scenario that I never though about: scoring based on runtime fields. You already added this to the runtime fields meta issue right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I added it.

@@ -120,6 +120,7 @@ protected Query doToQuery(QueryShardContext context) throws IOException {
return Queries.newMatchNoDocsQuery("Can't run [" + NAME + "] query on unmapped fields!");
}
Object originObj = origin.origin();
// TODO these ain't gonna work with runtime fields
Copy link
Member

Choose a reason for hiding this comment

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

interesting too, at least both of these are around parsing values, which you are making public so that we can reuse for runtime fields?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, we can handle this somehow.

return scriptFactory.newFactory(script.getParams(), context.lookup());
private AbstractLongScriptFieldScript.LeafFactory leafFactory(QueryShardContext context) {
LongScriptFieldScript.LeafFactory delegate = scriptFactory.newFactory(script.getParams(), context.lookup());
return ctx -> delegate.newInstance(ctx);
Copy link
Member

Choose a reason for hiding this comment

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

I get confused here on what has changed. why can't we return the long field script. given that we are in the long mapped field type?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't remember! I'll check.

Copy link
Member Author

Choose a reason for hiding this comment

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

It had to do with being able to share the queries. I've dropped it in favor of something a little more obvious.

@nik9000 nik9000 merged commit 35ca380 into elastic:feature/runtime_fields Jul 29, 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 Team:Search Meta label for search team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants