Skip to content

Commit b2b5a37

Browse files
Default OpenSearch source serverless search context to point_in_time (#6756)
Signed-off-by: Srikanth Padakanti <srikanth_padakanti@apple.com> Co-authored-by: Srikanth Padakanti <srikanth_padakanti@apple.com>
1 parent 79455e6 commit b2b5a37

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

data-prepper-plugins/opensearch/src/main/java/org/opensearch/dataprepper/plugins/source/opensearch/worker/client/SearchAccessorStrategy.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,9 @@ public SearchAccessor getSearchAccessor() {
145145

146146
private SearchAccessor createSearchAccessorForServerlessCollection(final PluginComponentRefresher clientRefresher) {
147147
if (Objects.isNull(openSearchSourceConfiguration.getSearchConfiguration().getSearchContextType())) {
148-
LOG.info("Configured with AOS serverless flag as true, defaulting to search_context_type as 'none', which uses search_after");
148+
LOG.info("Configured with AOS serverless flag as true, defaulting to search_context_type as 'point_in_time'");
149149
return new OpenSearchAccessor(clientRefresher,
150-
SearchContextType.NONE);
150+
SearchContextType.POINT_IN_TIME);
151151
} else {
152152
if ( SearchContextType.SCROLL.equals(openSearchSourceConfiguration.getSearchConfiguration().getSearchContextType())) {
153153
throw new InvalidPluginConfigurationException("A search_context_type of scroll is not supported for serverless collections");

data-prepper-plugins/opensearch/src/test/java/org/opensearch/dataprepper/plugins/source/opensearch/worker/client/SearchAccessStrategyTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ void search_context_type_set_to_none_uses_that_search_context_regardless_of_vers
210210
}
211211

212212
@Test
213-
void serverless_flag_true_defaults_to_search_context_type_none() {
213+
void serverless_flag_true_defaults_to_search_context_type_point_in_time() {
214214

215215
final AwsAuthenticationConfiguration awsAuthenticationConfiguration = mock(AwsAuthenticationConfiguration.class);
216216
when(awsAuthenticationConfiguration.isServerlessCollection()).thenReturn(true);
@@ -222,7 +222,7 @@ void serverless_flag_true_defaults_to_search_context_type_none() {
222222
final SearchAccessor searchAccessor = createObjectUnderTest().getSearchAccessor();
223223

224224
assertThat(searchAccessor, notNullValue());
225-
assertThat(searchAccessor.getSearchContextType(), equalTo(SearchContextType.NONE));
225+
assertThat(searchAccessor.getSearchContextType(), equalTo(SearchContextType.POINT_IN_TIME));
226226
verifyNoInteractions(pluginConfigObservable);
227227
}
228228

@@ -244,7 +244,7 @@ void serverless_flag_true_throws_InvalidPluginConfiguration_if_search_context_ty
244244
}
245245

246246
@ParameterizedTest
247-
@ValueSource(strings = {"NONE"})
247+
@ValueSource(strings = {"NONE", "POINT_IN_TIME"})
248248
void serverless_flag_true_uses_search_context_type_from_config(final String searchContextType) {
249249

250250
final AwsAuthenticationConfiguration awsAuthenticationConfiguration = mock(AwsAuthenticationConfiguration.class);

0 commit comments

Comments
 (0)