-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
Don't expose TextFieldMapper subfields #64597
Conversation
…apper/indexanalyzer
Pinging @elastic/es-search (:Search/Mapping) |
I've marked this as |
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 makes sense to me!
@@ -330,7 +329,7 @@ private TextFieldType buildFieldType(FieldType fieldType, BuilderContext context | |||
return ft; | |||
} | |||
|
|||
private PrefixFieldMapper buildPrefixMapper(BuilderContext context, FieldType fieldType, TextFieldType tft) { | |||
private SubFieldInfo buildPrefixMapper(BuilderContext context, FieldType fieldType, TextFieldType tft) { |
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.
buildPrefixMapper -> buildPrefixInfo
@@ -407,12 +405,18 @@ private PhraseFieldMapper buildPhraseMapper(FieldType fieldType, TextFieldType p | |||
public TextFieldMapper build(BuilderContext context) { | |||
FieldType fieldType = TextParams.buildFieldType(index, store, indexOptions, norms, termVectors); | |||
TextFieldType tft = buildFieldType(fieldType, context); | |||
PhraseFieldMapper phraseFieldMapper = buildPhraseMapper(fieldType, tft); | |||
PrefixFieldMapper prefixFieldMapper = buildPrefixMapper(context, fieldType, tft); | |||
SubFieldInfo phraseFieldMapper = buildPhraseInfo(fieldType, tft); |
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.
We could switch to the *Info
naming here too,
TextFieldMapper can optionally index data into subfields for accelerated prefix and phrase queries. Currently, these subfields are implemented as FieldMappers in their own right, made available via TextFieldMapper's iterator() method and with their own standalone MappedFieldType objects. This has the disadvantage that these subfields are directly available for searching, and appear in APIs such as field caps. In addition, because exists queries are not implemented on them, an exists query against an object which contains a text field with one of the subfields enabled can throw an error (see #63585). This commit reworks the subfields so that they are no longer implemented as FieldMappers, and are no longer exposed to classes outside TextFieldMapper either as MappedFieldTypes or as FieldMappers. The parent TextFieldMapper handles indexing and analyzer registration, PhraseFieldType is removed entirely, and PrefixFieldType is retained as a private implementation for fast prefix queries but is unavailable for querying directly. Fixes #63585 Closes #63446
TextFieldMapper can optionally index data into subfields for accelerated
prefix and phrase queries. Currently, these subfields are implemented
as FieldMappers in their own right, made available via TextFieldMapper's
iterator() method and with their own standalone MappedFieldType objects.
This has the disadvantage that these subfields are directly available for
searching, and appear in APIs such as field caps. In addition, because
exists queries are not implemented on them, an exists query against an
object which contains a text field with one of the subfields enabled can
throw an error (see #63585).
This commit reworks the subfields so that they are no longer implemented
as FieldMappers, and are no longer exposed to classes outside
TextFieldMapper either as MappedFieldTypes or as FieldMappers. The
parent TextFieldMapper handles indexing and analyzer registration,
PhraseFieldType is removed entirely, and PrefixFieldType is retained as
a private implementation for fast prefix queries but is unavailable for
querying directly.
Fixes #63585
Closes #63446
Closes #64585