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

FetchFieldsPhase needs to use local docid, not global #90901

Merged
merged 1 commit into from
Oct 14, 2022

Conversation

romseygeek
Copy link
Contributor

This commit passes the correct docid to value fetchers, and adds a new test
to exercise the behaviour explicitly and guard against regressions.

Fixes #90881

@romseygeek romseygeek added >non-issue :Search/Search Search-related issues that do not fall into other categories v8.6.0 labels Oct 14, 2022
@romseygeek romseygeek self-assigned this Oct 14, 2022
@romseygeek
Copy link
Contributor Author

Marked as >non-issue as this is as an unreleased bug

@elasticsearchmachine elasticsearchmachine added the Team:Search Meta label for search team label Oct 14, 2022
@elasticsearchmachine
Copy link
Collaborator

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

Copy link
Member

@javanna javanna left a comment

Choose a reason for hiding this comment

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

Small comment on testing, LGTM though

when(sec.nestedLookup()).thenReturn(NestedLookup.EMPTY);
FetchContext fetchContext = mock(FetchContext.class);
when(fetchContext.fetchFieldsContext()).thenReturn(ffc);
when(fetchContext.getSearchExecutionContext()).thenReturn(sec);
Copy link
Member

Choose a reason for hiding this comment

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

Would it be a lot of work to try and do without mocking? MapperServiceTestCase has a utility method to create a search execution context but it requires a mapper service instance. Wondering if it may be worth changing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We need a special MappedFieldType that returns a DocValueFetcher, and we don't have any core mappers that use DocValueFetcher. So somewhat counter-intuitively, not using mocks here ends up with much more ceremony because we need to register plugins and create special Mappers and TypeParsers, etc.

I would love to extract some interfaces from SearchExecutionContext though. Loads of places that take it only need the 'return all matching field types' functionality, and it's a very heavy object to construct for tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>non-issue :Search/Search Search-related issues that do not fall into other categories Team:Search Meta label for search team v8.6.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[CI] SizeMappingIT testGetWithFields failing
3 participants