Skip to content

Conversation

romseygeek
Copy link
Contributor

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.

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.
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-storage-engine (Team:StorageEngine)

@elasticsearchmachine elasticsearchmachine added the serverless-linked Added by automation, don't add manually label Oct 6, 2025
Copy link
Contributor

@gmarouli gmarouli left a 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);
Copy link
Contributor

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.

Copy link
Member

@felixbarny felixbarny left a 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.

@romseygeek romseygeek added the auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) label Oct 8, 2025
@elasticsearchmachine elasticsearchmachine merged commit da2cc5d into elastic:main Oct 8, 2025
34 checks passed
@romseygeek romseygeek deleted the mft/index-type-enum branch October 8, 2025 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) >non-issue serverless-linked Added by automation, don't add manually :StorageEngine/Mapping The storage related side of mappings Team:StorageEngine v9.3.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants