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

Implement NoSearchContextWorker to search with search_after and not use pit or scroll, allow override with search_context_type parameter #2873

Merged
merged 2 commits into from
Jun 15, 2023

Conversation

graytaylor0
Copy link
Member

@graytaylor0 graytaylor0 commented Jun 14, 2023

Description

  • Implements NoSearchContextWorker, which will process indices using sort and search_after without creating search contexts via scroll or point in time
  • Adds a new parameter to search_options, the search_context_type.

The search_context_type can be set to none, point_in_time, or scroll. By default, point in time will be used for versions that can support it, and scroll will be used for versions that don't support point in time.

However, there is a consideration to make the default just be none, and just use the version lookup to validate that point in time can be used if the search_context_type is set to point_in_time.

Issues Resolved

Related to #1985

Check List

  • New functionality includes testing.
  • New functionality has been documented.
    • New functionality has javadoc added
  • Commits are signed with a real name per the DCO

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

return null;
}

if (Objects.isNull(searchWithSearchAfterResults) && Objects.nonNull(openSearchIndexProgressState.getSearchAfter())) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

You should combine these two if statements otherwise it is little confusing.

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 don't understand what is confusing about it.

Copy link
Collaborator

Choose a reason for hiding this comment

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

It is not clear from the code that line at 148 searchWithSearchAfterResults is not null. better way of writing would be

if (Objects.isNull(searchWithSearchAfterResults)) {
      if (Objects.nonNull(openSearchIndexProgressState.getSearchAfter())( {
         return openSearchIndexProgressState.getSearchAfter();
     } else {
         return null;
     }
} 

This way we know after the code after the "if" block is the "else" block.

…se pit or scroll, allow override with search_context_type parameter

Signed-off-by: Taylor Gray <[email protected]>
Signed-off-by: Taylor Gray <[email protected]>
import java.util.Map;

public class SearchConfiguration {

private static final ObjectMapper objectMapper = new ObjectMapper();
private static final Logger LOG = LoggerFactory.getLogger(SearchConfiguration.class);

// TODO: Should we default this to NONE and remove the version lookup to determine scroll or point-in-time as the default behavior?
Copy link
Collaborator

@oeyh oeyh Jun 15, 2023

Choose a reason for hiding this comment

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

My thought is that this looks like a similar situation to s3.compression - we can set NONE as default and have "AUTO" as an explicit option to use the version-dependent method.

Copy link
Member Author

Choose a reason for hiding this comment

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

That's definitely a consideration. We can think about it more as this feature gets closer to release

@graytaylor0 graytaylor0 merged commit c7bfc2e into opensearch-project:main Jun 15, 2023
MaGonzalMayedo pushed a commit to MaGonzalMayedo/data-prepper that referenced this pull request Jun 21, 2023
…se pit or scroll, allow override with search_context_type parameter (opensearch-project#2873)

* Implement NoSearchContextWorker to search with search_after and not use pit or scroll, allow override with search_context_type parameter

Signed-off-by: Taylor Gray <[email protected]>
Signed-off-by: Marcos_Gonzalez_Mayedo <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants