Store keyword fields that trip ignore_above in binary doc values#137483
Conversation
2a64367 to
8bf42f4
Compare
...per-extras/src/main/java/org/elasticsearch/index/mapper/extras/MatchOnlyTextFieldMapper.java
Show resolved
Hide resolved
...per-extras/src/main/java/org/elasticsearch/index/mapper/extras/MatchOnlyTextFieldMapper.java
Outdated
Show resolved
Hide resolved
980e6c9 to
ffc2498
Compare
|
Pinging @elastic/es-storage-engine (Team:StorageEngine) |
|
The test is failing bc its expecting duplicate values, but with this change we're now deduplicating multi-valued fields in the same document. This is done for better storage efficiency. We can either change the test or keep the duplicates. |
server/src/main/java/org/elasticsearch/index/mapper/KeywordFieldMapper.java
Show resolved
Hide resolved
martijnvg
left a comment
There was a problem hiding this comment.
Looks good left a few comments.
server/src/main/java/org/elasticsearch/index/mapper/KeywordFieldMapper.java
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/index/mapper/KeywordFieldMapper.java
Outdated
Show resolved
Hide resolved
...r/src/main/java/org/elasticsearch/index/mapper/BinaryDocValuesSyntheticFieldLoaderLayer.java
Show resolved
Hide resolved
...per-extras/src/main/java/org/elasticsearch/index/mapper/extras/MatchOnlyTextFieldMapper.java
Show resolved
Hide resolved
...per-extras/src/main/java/org/elasticsearch/index/mapper/extras/MatchOnlyTextFieldMapper.java
Outdated
Show resolved
Hide resolved
b074b90 to
3d83988
Compare
3d83988 to
a1d1d2a
Compare
martijnvg
left a comment
There was a problem hiding this comment.
Let's wait for compression of binary doc values to have been merged and its feature flag removed, otherwise LGTM
...les/mapper-extras/src/yamlRestTest/resources/rest-api-spec/test/match_only_text/10_basic.yml
Show resolved
Hide resolved
…stic#137483) * Store keyword fields that trip ignore_above in binary doc values * Addressed feedback * Moved ignore values doc value field fetcher inside of existing fetcher function
| b.utf8Value(ref.bytes, ref.offset, ref.length); | ||
| } | ||
| }); | ||
| layers.add(new BinaryDocValuesSyntheticFieldLoaderLayer(fieldName)); |
There was a problem hiding this comment.
Will this break BWC? Because old indices will have their ignored values stored in a stored field, and now the mapper can no longer load those values?
| context.doc().add(new StoredField(fieldName, bytesRef)); | ||
|
|
||
| // store the value in a binary doc values field, create one if it doesn't exist | ||
| MultiValuedBinaryDocValuesField field = (MultiValuedBinaryDocValuesField) context.doc().getByKey(fieldName); | ||
| if (field == null) { | ||
| field = new MultiValuedBinaryDocValuesField(fieldName); | ||
| context.doc().addWithKey(fieldName, field); | ||
| } | ||
| field.add(bytesRef); |
There was a problem hiding this comment.
Another BWC issue - old indices will have conflicting fieldinfos for <name>._original since we're switching from using a stored field to binary doc values.
…ues (elastic#137483)" This reverts commit 6783135.
…lues (elastic#137483)" (elastic#138858) This reverts commit c6cdc01.
…lues (elastic#137483)" (elastic#138858) This reverts commit c6cdc01.
…9093) * Reapply "Store keyword fields that trip ignore_above in binary doc values (#137483)" (#138858) This reverts commit c6cdc01. * Added index version checks * Added BWC test # Conflicts: # x-pack/plugin/logsdb/qa/legacy-rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/KeywordRollingUpgradeIT.java * [CI] Auto commit changes from spotless * Fixed compilation errors after merging from main * Refactored KeywordRollingUpgradeIT to support serverless * [CI] Auto commit changes from spotless --------- Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
https://github.com/elastic/logs-program/issues/13