-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enhance Point In Time support with APIs to list active point-in-time …
…searches (#218) Signed-off-by: Andriy Redko <andriy.redko@aiven.io>
- Loading branch information
Showing
7 changed files
with
477 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
spring-data-opensearch/src/main/java/org/opensearch/data/core/OpenSearchOperations.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package org.opensearch.data.core; | ||
|
||
import java.time.Duration; | ||
import java.util.List; | ||
import org.springframework.data.elasticsearch.core.ElasticsearchOperations; | ||
|
||
/** | ||
* The extension over {@link ElasticsearchOperations} with OpenSearch specific operations. | ||
*/ | ||
public interface OpenSearchOperations extends ElasticsearchOperations { | ||
/** | ||
* Return all active point in time searches | ||
* @return all active point in time searches | ||
*/ | ||
List<PitInfo> listPointInTime(); | ||
|
||
/** | ||
* Describes the point in time entry | ||
* | ||
* @param id the point in time id | ||
* @param creationTime the time this point in time was created | ||
* @param keepAlive the new keep alive value for this point in time | ||
*/ | ||
record PitInfo(String id, long creationTime, Duration keepAlive) { | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
...c/test/java/org/opensearch/data/client/orhlc/OpenSearchORHLCSpecificIntegrationTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
package org.opensearch.data.client.orhlc; | ||
|
||
import static org.opensearch.index.query.QueryBuilders.matchAllQuery; | ||
|
||
import org.junit.jupiter.api.DisplayName; | ||
import org.opensearch.data.client.junit.jupiter.OpenSearchRestTemplateConfiguration; | ||
import org.opensearch.data.core.OpenSearchSpecificIntegrationTests; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.context.annotation.Import; | ||
import org.springframework.data.elasticsearch.core.query.BaseQueryBuilder; | ||
import org.springframework.data.elasticsearch.utils.IndexNameProvider; | ||
import org.springframework.test.context.ContextConfiguration; | ||
|
||
@ContextConfiguration(classes = {OpenSearchORHLCSpecificIntegrationTests.Config.class}) | ||
@DisplayName("Using OpenSearch RestHighLevelClient") | ||
public class OpenSearchORHLCSpecificIntegrationTests extends OpenSearchSpecificIntegrationTests { | ||
|
||
@Configuration | ||
@Import({OpenSearchRestTemplateConfiguration.class}) | ||
static class Config { | ||
@Bean | ||
IndexNameProvider indexNameProvider() { | ||
return new IndexNameProvider("integration-specific-os"); | ||
} | ||
} | ||
@Override | ||
protected BaseQueryBuilder<?, ?> getBuilderWithMatchAllQuery() { | ||
return new NativeSearchQueryBuilder().withQuery(matchAllQuery()); | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
...h/src/test/java/org/opensearch/data/client/osc/OpenSearchOSCSpecificIntegrationTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* Copyright 2022-2024 the original author or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.opensearch.data.client.osc; | ||
|
||
import org.junit.jupiter.api.DisplayName; | ||
import org.opensearch.data.client.junit.jupiter.OpenSearchTemplateConfiguration; | ||
import org.opensearch.data.core.OpenSearchSpecificIntegrationTests; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.context.annotation.Import; | ||
import org.springframework.data.elasticsearch.core.query.BaseQueryBuilder; | ||
import org.springframework.data.elasticsearch.utils.IndexNameProvider; | ||
import org.springframework.test.context.ContextConfiguration; | ||
|
||
/** | ||
* @author Farid Faoudi | ||
* @author Sascha Woo | ||
* @since 4.4 | ||
*/ | ||
@ContextConfiguration(classes = { OpenSearchOSCSpecificIntegrationTests.Config.class }) | ||
@DisplayName("Using OpenSearch Client") | ||
public class OpenSearchOSCSpecificIntegrationTests extends OpenSearchSpecificIntegrationTests { | ||
|
||
@Configuration | ||
@Import({ OpenSearchTemplateConfiguration.class }) | ||
static class Config { | ||
@Bean | ||
IndexNameProvider indexNameProvider() { | ||
return new IndexNameProvider("integration-specific-os"); | ||
} | ||
} | ||
|
||
@Override | ||
protected BaseQueryBuilder<?, ?> getBuilderWithMatchAllQuery() { | ||
return Queries.getBuilderWithMatchAllQuery(); | ||
} | ||
} |
Oops, something went wrong.