Skip to content

Disable request cache for non-deterministic runtime fields#75054

Merged
jimczi merged 14 commits into
elastic:masterfrom
jimczi:runtime_mapping_deterministic
Oct 21, 2021
Merged

Disable request cache for non-deterministic runtime fields#75054
jimczi merged 14 commits into
elastic:masterfrom
jimczi:runtime_mapping_deterministic

Conversation

@jimczi

@jimczi jimczi commented Jul 7, 2021

Copy link
Copy Markdown
Contributor

This change ensures that a non-deterministic script defined in the runtime mapping is not eligible
to the request cache.
It also moves the scripts that extract values from source to be considered deterministic.
Currently a source-only runtime field defined in a search request is not eligible to the request cache.
This commit fixes this discrepancy.

This change ensures that a non-deterministic script defined in the runtime mapping is not eligible
to the request cache.
It also moves the scripts that extract values from source to be considered deterministic.
Currently a source-only runtime field defined in a search request is not eligible to the request cache.
This commit fixes this discrepancy.
@jimczi jimczi added >bug :Search Foundations/Mapping Index mappings, including merging and defining field types v8.0.0 v7.14.1 v7.15.0 labels Jul 7, 2021
@elasticmachine elasticmachine added the Team:Search DEPRECATED - DO NOT USE label Jul 7, 2021
@elasticmachine

Copy link
Copy Markdown
Collaborator

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

Comment thread server/src/main/java/org/elasticsearch/index/mapper/AbstractScriptFieldType.java Outdated
Comment thread server/src/main/java/org/elasticsearch/index/mapper/AbstractScriptFieldType.java Outdated
@jimczi jimczi removed the v7.14.3 label Oct 15, 2021

@romseygeek romseygeek left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM!

Comment thread server/src/test/java/org/elasticsearch/index/mapper/IndexFieldMapperTests.java Outdated
* This method fails if {@link #freezeContext()} is called before on this context.
*/
public void disableCache() {
failIfFrozen();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It's a bit weird that failIfFrozen disables the cache, given that it sounds like it's just checking state, not mutating it. Maybe we should think about renaming this in a followup?

@jimczi jimczi added v7.16.1 and removed v7.16.0 labels Oct 21, 2021
@jimczi jimczi merged commit 78fcd0e into elastic:master Oct 21, 2021
@jimczi jimczi deleted the runtime_mapping_deterministic branch October 21, 2021 12:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

>bug :Search Foundations/Mapping Index mappings, including merging and defining field types Team:Search DEPRECATED - DO NOT USE v7.16.0 v8.0.0-beta1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants