Default highlightable? to false for returnable: false fields#1131
Open
Default highlightable? to false for returnable: false fields#1131
Conversation
When a field has `returnable: false` and no explicit `highlightable:` setting, `highlightable?` now returns false. This provides storage savings by default, since the primary reason for `returnable: false` is to exclude field data from `_source`. Users can still opt in to highlighting with `returnable: false, highlightable: true`. Also updates `source_excludes_paths` to check `highlightable?` when deciding what to exclude from `_source`, so that explicitly highlightable fields remain available for search highlight snippets. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
d874301 to
f8854db
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
highlightable?now returnsfalseforreturnable: falsefields when no explicithighlightable:is set, providing storage savings by default since non-returnable fields don't need to remain in_sourcefor highlightingsource_excludes_pathsnow checkshighlightable?when deciding what to exclude from_source, so explicitlyhighlightable: truefields stay available for search highlight snippets even whenreturnable: falsehighlightable: trueto the test schema'sinternal_nameandinternal_detailswidget fields to demonstrate the explicit opt-in patternWhy only
highlightable?highlightable?is the only-able?predicate wherereturnable: falsecreates a meaningful conflict. The other predicates all operate on indexed data (inverted index / doc values), which is always present regardless of_sourcesettings:sortable?— Sorting uses doc values, not_sourcefilterable?— Filtering runs against the inverted indexgroupable?— Grouping uses terms aggregations on indexed dataaggregatable?— Aggregations (min, max, avg, cardinality, etc.) use indexed datasub_aggregatable?— Nested sub-aggregations also work on indexed dataHighlighting is unique because the datastore must read the original text from
_sourceto produce contextual snippets (<em>matched text</em>). Whenreturnable: falseexcludes a field from_source, highlighting becomes impossible — making it the only predicate wherereturnable: falseshould influence the default.Test plan
elasticgraph-schema_definitionunit tests pass locallyelasticgraph-graphqlunit tests pass locally (1 pre-existing unrelated timezone failure)🤖 Generated with Claude Code