-
Notifications
You must be signed in to change notification settings - Fork 25.5k
Replace MappedFieldType isIndexed with finer-grained IndexType #135892
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
Replace MappedFieldType isIndexed with finer-grained IndexType #135892
Conversation
The addition of sparse indexes means that our existing isIndexed boolean does not provide enough information to select the best query strategy in several cases. This changes isIndexed to a new IndexType that contains information about the specific type of index structures available for a given field.
Pinging @elastic/es-storage-engine (Team:StorageEngine) |
server/src/main/java/org/elasticsearch/index/mapper/IndexType.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/index/mapper/IndexType.java
Outdated
Show resolved
Hide resolved
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.
LGTM. To the best of my abilities, I focused on checking if the correct enum was used, I would like to entertain @felixbarny idea, it could have made this review also easier. But if we choose to keep the enum, then I will +1
failIfNotIndexedNorDocValuesFallback(context); | ||
long scaledValue = Math.round(scale(value)); | ||
return NumberFieldMapper.NumberType.LONG.termQuery(name(), scaledValue, isIndexed()); | ||
return NumberFieldMapper.NumberType.LONG.termQuery(name(), scaledValue, indexType() == IndexType.POINTS); |
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.
Nit: should we use IndexType.hasPoints(indexType)
like in other places in this class, assuming it's the same?
My main reason is that when reading the code it makes me think that there is something different going on here and it requires the use of the explicit indexType() == IndexType.POINTS
. If that's the case, maybe a quick comment would be helpful.
server/src/main/java/org/elasticsearch/index/mapper/IndexType.java
Outdated
Show resolved
Hide resolved
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.
Mainly questions and nits, otherwise looks very good!
Looking forward to a follow-up that allows dimension fields to have doc value skippers instead of a full index. But possibly this is a bit orthogonal to the IndexType
.
The addition of sparse indexes means that our existing isIndexed boolean
does not provide enough information to select the best query strategy in
several cases. This changes isIndexed to a new IndexType that contains
information about the specific type of index structures available for a given field.