-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Fixed a bug where text fields in LogsDB indices did not use their keyword multi fields for block loading #134253
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
Hi @Kubik42, I've created a changelog YAML for you. |
f0bcd32
to
8843756
Compare
} | ||
|
||
public boolean isIgnoreAboveSet() { | ||
return ignoreAbove != ignoreAboveDefaultValue; |
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.
I'm not a huge fan of storing ignoreAboveDefaultValue
, but its better than the alternatives:
- add
indexMode
andindexCreatedVersion
as class fields inKeywrodFieldType
and then callgetIgnoreAboveDefaultValue()
every timeisIgnoreAboveSet()
is called - pass
indexMode
andindexCreatedVersion
as parameters intoisIgnoreAboveSet()
- decide whether ignore_above is set in the constructor; ie. have an extra field called
isIgnoreAboveSet
at the class level - this is error prone as it must be manually set to false in 3/5 constructors thatKeywordFieldType
has.
Perhaps we could revisit the default value for ignore above in the future and just default everything to one value rather than picking and choosing based on the index mode, but thats out of scope for this change.
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.
I don't think keeping that of default ignored above isn't too bad here. I think it is better than the alternative.
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.
Perhaps we could revisit the default value for ignore above in the future and just default everything to one value rather than picking and choosing based on the index mode, but thats out of scope for this change.
Also that would require more input from other teams.
private final FieldValues<String> scriptValues; | ||
private final boolean isDimension; | ||
private final boolean isSyntheticSource; | ||
private final IndexMode indexMode; |
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.
removed - wasn't being used anywhere
/** | ||
* Generates a string containing a random number of random length alphas, all delimited by space. | ||
*/ | ||
public static String randomAlphasDelimitedBySpace(int maxAlphas, int minCodeUnits, int maxCodeUnits) { |
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.
this helps with BWC tests by providing randomized strings that are more accurate to what customers would use; ie. space separated tokens
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.
Let's keep this in the TextRollingUpgradeIT
? This is the only user for now.
Hi @Kubik42, I've created a changelog YAML for you. |
Pinging @elastic/es-storage-engine (Team:StorageEngine) |
} | ||
|
||
public boolean isIgnoreAboveSet() { | ||
return ignoreAbove != ignoreAboveDefaultValue; |
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.
I don't think keeping that of default ignored above isn't too bad here. I think it is better than the alternative.
} | ||
|
||
public boolean isIgnoreAboveSet() { | ||
return ignoreAbove != ignoreAboveDefaultValue; |
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.
Perhaps we could revisit the default value for ignore above in the future and just default everything to one value rather than picking and choosing based on the index mode, but thats out of scope for this change.
Also that would require more input from other teams.
server/src/main/java/org/elasticsearch/index/mapper/KeywordFieldMapper.java
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/index/mapper/FieldMapper.java
Outdated
Show resolved
Hide resolved
9c6eee7
to
577aa8b
Compare
Hi @Kubik42, I've created a changelog YAML for you. |
0a92f63
to
6f8b187
Compare
Update: so while I was brainstorming for how to cleanly handle tldr: when we have an index-level |
Hi @Kubik42, I've created a changelog YAML for you. |
a725363
to
b07ddf4
Compare
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.
Left two more comments, LGTM otherwise.
/** | ||
* Generates a string containing a random number of random length alphas, all delimited by space. | ||
*/ | ||
public static String randomAlphasDelimitedBySpace(int maxAlphas, int minCodeUnits, int maxCodeUnits) { |
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.
Let's keep this in the TextRollingUpgradeIT
? This is the only user for now.
💔 Backport failed
You can use sqren/backport to manually backport by running |
…word multi fields for block loading (elastic#134253) * Added keyword multi field with ignore_above to match only text bwc tests * Rework ignore_above * Added unit tests * Undo changed to match only text bwc test * formatting * Removed indexMode from field type * Added another test case * Fixed failing bwc tests * Improved msg * Added additional tests * Added IgnoreAbove record, addressed index-level ignore above * Fixed test typos * Added IgnoreAboveTest * Enforce at least one value or defaultValue to always be non-null when IgnoreAbove is initialized * When initializing IgnoreAbove, dont use defaultValue from builder - this fixes failing BWC test * Fixed typo * Switched IgnoreAbove to constructor only, removed the ability to set default directly * Update docs/changelog/134253.yaml * Update 134253.yaml * Move IgnoreAbove into Mapper and make it final, move everything new out of IndexSettings and into IgnoreAbove * Fixed typo * Added helpful constructor to IgnoreAbove * Added helpful constructor to IgnoreAbove (cherry picked from commit 2c3bee7) # Conflicts: # server/src/main/java/org/elasticsearch/index/mapper/FieldMapper.java # server/src/main/java/org/elasticsearch/index/mapper/KeywordFieldMapper.java
💚 All backports created successfully
Questions ?Please refer to the Backport tool documentation |
…word multi fields for block loading (elastic#134253) * Added keyword multi field with ignore_above to match only text bwc tests * Rework ignore_above * Added unit tests * Undo changed to match only text bwc test * formatting * Removed indexMode from field type * Added another test case * Fixed failing bwc tests * Improved msg * Added additional tests * Added IgnoreAbove record, addressed index-level ignore above * Fixed test typos * Added IgnoreAboveTest * Enforce at least one value or defaultValue to always be non-null when IgnoreAbove is initialized * When initializing IgnoreAbove, dont use defaultValue from builder - this fixes failing BWC test * Fixed typo * Switched IgnoreAbove to constructor only, removed the ability to set default directly * Update docs/changelog/134253.yaml * Update 134253.yaml * Move IgnoreAbove into Mapper and make it final, move everything new out of IndexSettings and into IgnoreAbove * Fixed typo * Added helpful constructor to IgnoreAbove * Added helpful constructor to IgnoreAbove (cherry picked from commit 2c3bee7) # Conflicts: # modules/mapper-extras/src/main/java/org/elasticsearch/index/mapper/extras/MatchOnlyTextFieldMapper.java # qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/TextRollingUpgradeIT.java # server/src/main/java/org/elasticsearch/index/mapper/FieldMapper.java # server/src/main/java/org/elasticsearch/index/mapper/KeywordFieldMapper.java # server/src/main/java/org/elasticsearch/index/mapper/TextFieldMapper.java # server/src/test/java/org/elasticsearch/index/mapper/KeywordFieldTypeTests.java # server/src/test/java/org/elasticsearch/index/mapper/MultiFieldsTests.java # x-pack/plugin/wildcard/src/main/java/org/elasticsearch/xpack/wildcard/mapper/WildcardFieldMapper.java
💚 All backports created successfully
Questions ?Please refer to the Backport tool documentation |
…word multi fields for block loading (elastic#134253)
…word multi fields for block loading (elastic#134253) (elastic#134591)
This addresses #134096
More specifically, this PR does the following:
ignore_above
is initialized. More specifically,FieldTypes
andFieldMappers
no longer have a simple integer representingignore_above
as thats been proved to be error prone. For example, in Text fields incorrectly fallback to source in block loader for logsdb indices #134096 we checked the wrong default value. With this change,ignore_above
is now represented by a new classIgnoreAbove
, which doesn't allow the setting of the default value and instead infers it fromIndexMode
andIndexVersion
.IgnoreAbove
class, which provides nice utility functions likeisIgnored()
andisSet()
, which are reused across several field mappers. This eliminates the need to saveignoreAboutDefault
and removes duplicate code code blocks such asstring.length() > ignoreAbove
TextRollingUpgradeIT
, which is a nearly identical copy ofMatchOnlyTextRollingUpgradeIT
. This BWC test was previously missing, hence its addition. The addition of this test also helps validate Don't store keyword multi fields when they trip ignore_above #132962syntheticSourceDelegate
inside ofblockLoader()
. See my comments for more details