-
Notifications
You must be signed in to change notification settings - Fork 25.7k
Add runtime field section to Field Capabilities API #68904
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
Conversation
Currently runtime fields from search requests don't appear in the output of the field capabilities API, but some consumer of runtime fields would like to see runtime section just like they are defined in search requests reflected and merged into the field capabilities output. This change adds parsing of a "runtime_mappings" section equivallent to the one on search requests to the `_field_caps` endpoint, passes this section down to the shard level where any runtime fields defined here overwrite the mapping of the targetet indices. Closes elastic#68117
|
Pinging @elastic/es-search (Team:Search) |
|
One caveat of this PR: I found that we do not propagate back exceptions thrown in the shard operation in The resulting MapperParsingException in that is thrown when parsing the runtime fields upon creating the |
jimczi
left a comment
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
javanna
left a comment
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.
The change looks good to me, error handling looks like wasn't part of the initial design of field_caps and it now becomes more important as scripts may not compile etc. Although field_caps should not be used to validate scripts (and possibly we should not even need to compile them for field_caps), returning an empty response whenever there is an error does not seem like a good idea.
I'd say merge this one and let's discuss and work on the error handling as a follow-up?
| request -> request.indexFilter(request.indexFilter() != null ? request.indexFilter().boost(2) : QueryBuilders.matchAllQuery()) | ||
| ); | ||
| mutators.add(request -> request.runtimeFields(Collections.singletonMap("other_key", "other_value"))); | ||
|
|
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.
would it make sense to add a test for the toXContent output of the request if we don't test it yet?
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.
sure, will do
Co-authored-by: Jim Ferenczi <jim.ferenczi@elastic.co>
Currently runtime fields from search requests don't appear in the output of the field capabilities API, but some consumer of runtime fields would like to see runtime section just like they are defined in search requests reflected and merged into the field capabilities output. This change adds parsing of a "runtime_mappings" section equivallent to the one on search requests to the `_field_caps` endpoint, passes this section down to the shard level where any runtime fields defined here overwrite the mapping of the targetet indices. Closes elastic#68117
Currently runtime fields from search requests don't appear in the output of the field capabilities API, but some consumer of runtime fields would like to see runtime section just like they are defined in search requests reflected and merged into the field capabilities output. This change adds parsing of a "runtime_mappings" section equivallent to the one on search requests to the `_field_caps` endpoint, passes this section down to the shard level where any runtime fields defined here overwrite the mapping of the targetet indices. Closes #68117
Typically we silently ignore nodes below a certain version that don't support a specific feature when serializing requests between nodes. With runtime fields we chose to throw errors instead when one of the nodes a search request is sent to has a version that does not support the runtime fields feature. This change adds the same behaviour for support of the "runtime_mappings" section introduced in elastic#68904 in the "_field_caps" API. Relates to elastic#68904
Typically we silently ignore nodes below a certain version that don't support a specific feature when serializing requests between nodes. With runtime fields we chose to throw errors instead when one of the nodes a search request is sent to has a version that does not support the runtime fields feature. This change adds the same behaviour for support of the "runtime_mappings" section introduced in #68904 in the "_field_caps" API. Relates to #68904
Typically we silently ignore nodes below a certain version that don't support a specific feature when serializing requests between nodes. With runtime fields we chose to throw errors instead when one of the nodes a search request is sent to has a version that does not support the runtime fields feature. This change adds the same behaviour for support of the "runtime_mappings" section introduced in #68904 in the "_field_caps" API. Relates to #68904
Typically we silently ignore nodes below a certain version that don't support a specific feature when serializing requests between nodes. With runtime fields we chose to throw errors instead when one of the nodes a search request is sent to has a version that does not support the runtime fields feature. This change adds the same behaviour for support of the "runtime_mappings" section introduced in #68904 in the "_field_caps" API. Relates to #68904
Currently runtime fields from search requests don't appear in the output of the
field capabilities API, but some consumer of runtime fields would like to see
runtime section just like they are defined in search requests reflected and
merged into the field capabilities output.
This change adds parsing of a "runtime_mappings" section equivallent to the one
on search requests to the
_field_capsendpoint, passes this section down tothe shard level where any runtime fields defined here overwrite the mapping of
the targetet indices.
Closes #68117