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

Re-add support for some metadata field parameters #118825

Merged
merged 6 commits into from
Dec 18, 2024

Conversation

cbuescher
Copy link
Member

We removed support for type, fields, copy_to and boost in metadata field definitions with #116944 but with the move towards supporting N-2 read-only indices we need to add them back. This change reverts previous removal commits and adapts tests to also check we now throw errors for newly created indices.

We removed support for type, fields, copy_to and boost in metadata field
definitions with elastic#116944 but with the move towards supporting N-2
read-only indices we need to add them back. This change reverts previous
removal commits and adapts tests to also check we now throw errors for
newly created indices.
@cbuescher cbuescher added :Search Foundations/Search Catch all for Search Foundations v9.0.0 labels Dec 17, 2024
@elasticsearchmachine elasticsearchmachine added the Team:Search Foundations Meta label for the Search Foundations team in Elasticsearch label Dec 17, 2024
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-search-foundations (Team:Search Foundations)

@cbuescher cbuescher added >breaking and removed Team:Search Foundations Meta label for the Search Foundations team in Elasticsearch labels Dec 17, 2024
@elasticsearchmachine elasticsearchmachine added the Team:Search Foundations Meta label for the Search Foundations team in Elasticsearch label Dec 17, 2024
@elasticsearchmachine
Copy link
Collaborator

Hi @cbuescher, I've created a changelog YAML for you. Note that since this PR is labelled >breaking, you need to update the changelog YAML to fill out the extended information sections.

@cbuescher cbuescher added :Search Foundations/Mapping Index mappings, including merging and defining field types and removed Team:Search Foundations Meta label for the Search Foundations team in Elasticsearch :Search Foundations/Search Catch all for Search Foundations labels Dec 17, 2024
@elasticsearchmachine elasticsearchmachine added the Team:Search Foundations Meta label for the Search Foundations team in Elasticsearch label Dec 17, 2024
@@ -19,4 +19,6 @@ public class KnownIndexVersions {
* A sorted list of all known transport versions
*/
public static final List<IndexVersion> ALL_VERSIONS = List.copyOf(IndexVersions.getAllVersions());

public static final List<IndexVersion> ALL_READ_ONLY_VERSIONS = List.copyOf(IndexVersions.getAllReadOnlyVersions());
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'm not entirely sure why we need this list copy but since thats the pattern for ALL_VERSIONS I thought its save to do the same. Maybe someone know why we need that for ALL_VERSIONS?

Copy link
Contributor

Choose a reason for hiding this comment

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

By checking its history a bit, I think, the initial intention was to make a defensive copy of the list, which is immutable in the current version. The list was also unmodifiable when it was first introduced: #93384

Copy link
Member

Choose a reason for hiding this comment

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

I wonder if we need to have a list with read only versions. Could we instead just add a new method to get read only versions? Also, should we instead have a new method that returns all versions, writeable and read-only, as opposed to having special tests for read-only indices? My expectations it that the majority of the cases will need read support, and no write, hence the special case should probably be for writing and not for reading.

Copy link
Member

Choose a reason for hiding this comment

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

I think what I said above is necessarily correct. Switching randomizations to include read-only version cause quite a bit of issues. It makes sense to add for now a new list, we'll clean it up later. A question remains if that list should contain all versions including readonly or only read-only versions.

@@ -144,6 +150,22 @@ public final void parseMetadataField(String name, MappingParserContext parserCon
final Object propNode = entry.getValue();
Parameter<?> parameter = paramsMap.get(propName);
if (parameter == null) {
IndexVersion indexVersionCreated = parserContext.indexVersionCreated();
if (indexVersionCreated.before(IndexVersions.UPGRADE_TO_LUCENE_10_0_0)
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'm not entirely sure if UPGRADE_TO_LUCENE_10_0_0 should be the point in time we should start to throw errors. We first removed support for these parameters with #116944 (8a7491c) at which point we already have more recent IndexVersions (see

public static final IndexVersion LOGSDB_DEFAULT_IGNORE_DYNAMIC_BEYOND_LIMIT = def(9_001_00_0, Version.LUCENE_10_0_0);
). To me that means indices with e.g. IndexVersion TIME_BASED_K_ORDERED_DOC_ID could still use those parameters? Please keep me honest here.

Copy link
Member

Choose a reason for hiding this comment

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

good point. Tricky question. I don't expect it to matter a lot because these unsupported params should not be common at all. The removal affects only serverless users indeed, but I'm afraid it can't be associated to a specific index version. If we meant to do so we'd have needed to add an index versions associated with the removal?

I am fine with using what you are using, or in alternative adding a new index version now.

@@ -144,6 +150,22 @@ public final void parseMetadataField(String name, MappingParserContext parserCon
final Object propNode = entry.getValue();
Parameter<?> parameter = paramsMap.get(propName);
if (parameter == null) {
IndexVersion indexVersionCreated = parserContext.indexVersionCreated();
if (indexVersionCreated.before(IndexVersions.UPGRADE_TO_LUCENE_10_0_0)
Copy link
Member

Choose a reason for hiding this comment

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

good point. Tricky question. I don't expect it to matter a lot because these unsupported params should not be common at all. The removal affects only serverless users indeed, but I'm afraid it can't be associated to a specific index version. If we meant to do so we'd have needed to add an index versions associated with the removal?

I am fine with using what you are using, or in alternative adding a new index version now.

IndexVersion indexVersionCreated = parserContext.indexVersionCreated();
if (indexVersionCreated.before(IndexVersions.UPGRADE_TO_LUCENE_10_0_0)
&& UNSUPPORTED_PARAMETERS_8_6_0.contains(propName)) {
if (indexVersionCreated.onOrAfter(IndexVersions.V_8_6_0)) {
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if we should leave the deprecation under that conditional. What do you think?

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'm not sure I understand entirely. Under which conditions do you think we should issue a deprecation? As I see this atm before 8.6 we silently ignore, from 8.6 to 9 (or rather IndexVersions.UPGRADE_TO_LUCENE_10_0_0) we issue a deprecation and afterwards we throw. Do you mean reorganizing code to reflect that better or different behaviour?

Copy link
Member

Choose a reason for hiding this comment

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

I think I misread, we are good then.

@@ -19,4 +19,6 @@ public class KnownIndexVersions {
* A sorted list of all known transport versions
*/
public static final List<IndexVersion> ALL_VERSIONS = List.copyOf(IndexVersions.getAllVersions());

public static final List<IndexVersion> ALL_READ_ONLY_VERSIONS = List.copyOf(IndexVersions.getAllReadOnlyVersions());
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if we need to have a list with read only versions. Could we instead just add a new method to get read only versions? Also, should we instead have a new method that returns all versions, writeable and read-only, as opposed to having special tests for read-only indices? My expectations it that the majority of the cases will need read support, and no write, hence the special case should probably be for writing and not for reading.

@cbuescher
Copy link
Member Author

I'll wait for #118793 to get in before cleaning up and updating this PR

@cbuescher
Copy link
Member Author

@javanna updates this with the index version randomization changes and left a small question for you.

@cbuescher
Copy link
Member Author

@elasticmachine run elasticsearch-ci/part-1

@cbuescher cbuescher merged commit cc69e06 into elastic:main Dec 18, 2024
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>breaking :Search Foundations/Mapping Index mappings, including merging and defining field types Team:Search Foundations Meta label for the Search Foundations team in Elasticsearch v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants