Skip to content

Remove type handling in LeafFieldsLookup#64041

Merged
javanna merged 3 commits intoelastic:masterfrom
javanna:refactoring/remove_type_leaf_lookup
Oct 26, 2020
Merged

Remove type handling in LeafFieldsLookup#64041
javanna merged 3 commits intoelastic:masterfrom
javanna:refactoring/remove_type_leaf_lookup

Conversation

@javanna
Copy link
Copy Markdown
Contributor

@javanna javanna commented Oct 22, 2020

Access to type in scripts is deprecated in 7.x, so we don't need to support it in master(8.x).

@javanna javanna added :Search Foundations/Mapping Index mappings, including merging and defining field types >refactoring v8.0.0 labels Oct 22, 2020
@javanna javanna requested a review from romseygeek October 22, 2020 08:42
@elasticmachine
Copy link
Copy Markdown
Collaborator

Pinging @elastic/es-search (:Search/Mapping)

final DocumentMapper mapper = mapperService.documentMapper();
if (mapper != null) {
values.add(mapper.type());
}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Is this what you meant @romseygeek ? Are we sure that we can drop this? Looks like a breaking change to me, wondering if it's worth leaving it around although it is constant, not sure.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It is a breaking change, but I think it comes under the general umbrella of types removal so probably doesn't need a specific call-out. If you try and use _type in a script in 7x you get a deprecation warning so I think it's fine to remove it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

the problem here may be that the field type does come up by name, but then it fails to retrieve values from lucene, or is that ok?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I see what you mean. Maybe we should be removing the special-casing in MapperService.fieldType() in master as well, given that it's deprecated generally in 7.x. @jtibshirani what do you think?

Copy link
Copy Markdown
Contributor

@jtibshirani jtibshirani Oct 22, 2020

Choose a reason for hiding this comment

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

I just caught up on the code and was surprised to see we still have TypeFieldType in master. Is there a reason we added this special logic instead of removing TypeFieldType entirely, which would disallow all search operations on _type?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think I added this as a stop-gap while backporting the various type field deprecations. I'll open a PR to remove it entirely in master.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

One question I had -- does removing this have an implication for our API version compatibility efforts? I'm not up-to-date on our collaborations there.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Version compatibility only applies to the 'shape' of the request, as I understand it. So we need to support type queries, but we don't need to support queries against the field _type (otherwise we'd never be able to deprecate types at all...)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

thanks for the input. It looks like this can go in then, and as a follow-up we will also remove TypeFieldType completely, which sounds like a good plan to me.

Copy link
Copy Markdown
Contributor

@romseygeek romseygeek left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@javanna javanna merged commit 0c7cd83 into elastic:master Oct 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

>refactoring :Search Foundations/Mapping Index mappings, including merging and defining field types Team:Search Meta label for search team v8.0.0-alpha1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants