Skip to content
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

Add lookup index mode #115143

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Add lookup index mode #115143

wants to merge 3 commits into from

Conversation

dnhatn
Copy link
Member

@dnhatn dnhatn commented Oct 18, 2024

This change introduces a new index mode, lookup, for indices intended for lookup operations in ES|QL. Lookup indices must have a single shard and be replicated to all data nodes by default. Aside from these requirements, they function as standard indices. Documentation will be added later when the lookup operator in ES|QL is implemented.

@dnhatn dnhatn force-pushed the lookup-mode branch 8 times, most recently from 5570065 to 88f9c68 Compare October 18, 2024 23:15
@elasticsearchmachine elasticsearchmachine added the serverless-linked Added by automation, don't add manually label Oct 19, 2024
@dnhatn dnhatn added v8.17.0 :Analytics/ES|QL AKA ESQL >non-issue auto-backport Automatically create backport pull requests when merged labels Oct 19, 2024
@dnhatn dnhatn marked this pull request as ready for review October 19, 2024 03:10
@elasticsearchmachine elasticsearchmachine added the Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) label Oct 19, 2024
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-analytical-engine (Team:Analytics)

void validateWithOtherSettings(Map<Setting<?>, Object> settings) {
Integer defaultNumberOfShards = IndexMetadata.INDEX_NUMBER_OF_SHARDS_SETTING.get(Settings.EMPTY);
Object providedNumberOfShards = settings.getOrDefault(IndexMetadata.INDEX_NUMBER_OF_SHARDS_SETTING, defaultNumberOfShards);
if (Objects.equals(providedNumberOfShards, defaultNumberOfShards) == false) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe just check whether providedNumberOfShards is 1?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

++, I pushed d84de07

public Settings defaultIndexSettings() {
return Settings.builder()
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
.put(IndexMetadata.SETTING_AUTO_EXPAND_REPLICAS, "0-all")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also validate whether auto expand replicas is really enabled? This just defines the defaults, but doesn't enforce that it is actually used?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I may be missing something, but the default settings are copied to the index settings when creating an index: https://github.com/elastic/elasticsearch/pull/115143/files#diff-c02a1326ed501a89ce49b7e7a27df4bb9a2256785d00d7278bccb3609334b939R1112

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, the default settings are added after template and create index request settings have been applied. Maybe default settings is the wrong name? Since the settings from index mode don't act as default, but are enforced?

Additionally I think we need to mimic this logic in two other places too for consistency:

  1. MetadataIndexTemplateService#validateIndexTemplateV2(...) to ensure that index mode default settings are applied during template validation.
  2. TransportSimulateIndexTemplateAction#resolveTemplate(...) to ensure that index mode default settings are applied during simulate template api.

@dnhatn dnhatn requested a review from martijnvg October 19, 2024 16:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Analytics/ES|QL AKA ESQL auto-backport Automatically create backport pull requests when merged >non-issue serverless-linked Added by automation, don't add manually Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) v8.17.0 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants