├── .github ├── CODEOWNERS ├── dependabot.yml ├── pull_request_template.md └── workflows │ ├── add-untriaged.yml │ ├── codeql-analysis.yml │ ├── main_and_pr_workflow.yml │ ├── publish-snapshots.yml │ └── release-drafter.yml ├── .gitignore ├── .whitesource ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE.txt ├── MAINTAINERS.md ├── NOTICE.txt ├── README.md ├── RELEASING.md ├── build.gradle.kts ├── buildSrc ├── build.gradle.kts └── src │ └── main │ └── kotlin │ └── java-conventions.gradle.kts ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── jenkins └── release.jenkinsFile ├── settings.gradle.kts ├── spring-data-opensearch-docker-compose ├── build.gradle.kts └── src │ ├── main │ ├── java │ │ └── org │ │ │ └── opensearch │ │ │ └── spring │ │ │ └── boot │ │ │ └── docker │ │ │ └── compose │ │ │ └── service │ │ │ └── connection │ │ │ ├── OpenSearchDockerComposeConnectionDetailsFactory.java │ │ │ └── OpenSearchEnvironment.java │ └── resources │ │ └── META-INF │ │ └── spring.factories │ └── test │ ├── java │ └── org │ │ └── opensearch │ │ └── spring │ │ └── boot │ │ └── docker │ │ └── compose │ │ └── service │ │ └── connection │ │ ├── OpenSearchDockerComposeConnectionDetailsFactoryTest.java │ │ └── SecureOpenSearchDockerComposeConnectionDetailsFactoryTest.java │ └── resources │ └── org │ └── opensearch │ └── spring │ └── boot │ └── docker │ └── compose │ └── service │ └── connection │ ├── opensearch-compose.yaml │ └── secure-opensearch-compose.yaml ├── spring-data-opensearch-examples ├── spring-boot-gradle │ ├── README.md │ ├── build.gradle.kts │ └── src │ │ ├── main │ │ ├── java │ │ │ └── org │ │ │ │ └── opensearch │ │ │ │ └── data │ │ │ │ └── example │ │ │ │ ├── MarketplaceApplication.java │ │ │ │ ├── MarketplaceConfiguration.java │ │ │ │ ├── model │ │ │ │ └── Product.java │ │ │ │ ├── repository │ │ │ │ └── MarketplaceRepository.java │ │ │ │ ├── rest │ │ │ │ └── MarketplaceRestController.java │ │ │ │ └── service │ │ │ │ └── MarketplaceInitializer.java │ │ └── resources │ │ │ └── application.yml │ │ └── test │ │ └── java │ │ └── org │ │ └── opensearch │ │ └── data │ │ └── example │ │ └── repository │ │ ├── MarketplaceRepositoryIntegrationTests.java │ │ └── TestMarketplaceApplication.java └── spring-boot-java-client-gradle │ ├── README.md │ ├── build.gradle.kts │ └── src │ ├── main │ ├── java │ │ └── org │ │ │ └── opensearch │ │ │ └── data │ │ │ └── example │ │ │ ├── MarketplaceApplication.java │ │ │ ├── MarketplaceConfiguration.java │ │ │ ├── model │ │ │ └── Product.java │ │ │ ├── repository │ │ │ └── MarketplaceRepository.java │ │ │ ├── rest │ │ │ └── MarketplaceRestController.java │ │ │ └── service │ │ │ └── MarketplaceInitializer.java │ └── resources │ │ └── application.yml │ └── test │ └── java │ └── org │ └── opensearch │ └── data │ └── example │ └── repository │ ├── MarketplaceRepositoryIntegrationTests.java │ └── TestMarketplaceApplication.java ├── spring-data-opensearch-starter ├── build.gradle.kts └── src │ ├── main │ ├── java │ │ └── org │ │ │ └── opensearch │ │ │ └── spring │ │ │ └── boot │ │ │ └── autoconfigure │ │ │ ├── OpenSearchClientAutoConfiguration.java │ │ │ ├── OpenSearchClientConfigurations.java │ │ │ ├── OpenSearchConnectionDetails.java │ │ │ ├── OpenSearchProperties.java │ │ │ ├── OpenSearchRestClientAutoConfiguration.java │ │ │ ├── OpenSearchRestClientConfigurations.java │ │ │ ├── OpenSearchRestHighLevelClientAutoConfiguration.java │ │ │ ├── OpenSearchRestHighLevelClientConfigurations.java │ │ │ ├── RestClientBuilderCustomizer.java │ │ │ └── data │ │ │ ├── OpenSearchDataAutoConfiguration.java │ │ │ └── OpenSearchDataConfiguration.java │ └── resources │ │ └── META-INF │ │ └── spring │ │ └── org.springframework.boot.autoconfigure.AutoConfiguration.imports │ └── test │ ├── java │ └── org │ │ └── opensearch │ │ └── spring │ │ └── boot │ │ └── autoconfigure │ │ ├── AbstractOpenSearchIntegrationTest.java │ │ ├── OpenSearchRestClientAutoConfigurationIntegrationTests.java │ │ ├── OpenSearchRestClientAutoConfigurationTests.java │ │ ├── OpenSearchRestHighLevelClientAutoConfigurationTests.java │ │ └── data │ │ ├── OpenSearchDataAutoConfigurationIntegrationTests.java │ │ ├── OpenSearchDataAutoConfigurationTests.java │ │ ├── entity │ │ ├── Product.java │ │ └── ProductOpenSearchRepository.java │ │ └── repository │ │ └── ProductRepository.java │ └── resources │ ├── opensearch-demo-ca.pem │ └── testcontainers-opensearch.properties ├── spring-data-opensearch-test-autoconfigure ├── build.gradle.kts └── src │ └── main │ ├── java │ └── org │ │ └── opensearch │ │ └── spring │ │ └── boot │ │ └── autoconfigure │ │ └── test │ │ ├── AutoConfigureDataOpenSearch.java │ │ ├── DataOpenSearchTest.java │ │ ├── DataOpenSearchTestContextBootstrapper.java │ │ └── OpenSearchTypeExcludeFilter.java │ └── resources │ └── META-INF │ └── spring │ └── org.opensearch.spring.boot.autoconfigure.test.AutoConfigureDataOpenSearch.imports ├── spring-data-opensearch-testcontainers ├── build.gradle.kts └── src │ ├── main │ ├── java │ │ └── org │ │ │ └── opensearch │ │ │ └── spring │ │ │ └── boot │ │ │ └── testcontainers │ │ │ └── service │ │ │ └── connection │ │ │ └── OpenSearchContainerConnectionDetailsFactory.java │ └── resources │ │ └── META-INF │ │ └── spring.factories │ └── test │ ├── java │ └── org │ │ └── opensearch │ │ └── spring │ │ └── boot │ │ └── testcontainers │ │ └── service │ │ └── connection │ │ ├── OpenSearchContainerConnectionDetailsFactoryIntegrationTests.java │ │ └── SecureOpenSearchContainerConnectionDetailsFactoryIntegrationTests.java │ └── resources │ └── logback-test.xml ├── spring-data-opensearch ├── build.gradle.kts └── src │ ├── main │ └── java │ │ └── org │ │ └── opensearch │ │ └── data │ │ ├── client │ │ ├── orhlc │ │ │ ├── AbstractOpenSearchConfiguration.java │ │ │ ├── ClientConfiguration.java │ │ │ ├── ClientConfigurationBuilder.java │ │ │ ├── CriteriaFilterProcessor.java │ │ │ ├── CriteriaQueryProcessor.java │ │ │ ├── DefaultClientConfiguration.java │ │ │ ├── DefaultClusterOperations.java │ │ │ ├── DocumentAdapters.java │ │ │ ├── HighlightQueryBuilder.java │ │ │ ├── NativeSearchQuery.java │ │ │ ├── NativeSearchQueryBuilder.java │ │ │ ├── OpenSearchAggregations.java │ │ │ ├── OpenSearchClusterOperations.java │ │ │ ├── OpenSearchExceptionTranslator.java │ │ │ ├── OpenSearchRestTemplate.java │ │ │ ├── RequestConverters.java │ │ │ ├── RequestFactory.java │ │ │ ├── ResponseConverter.java │ │ │ ├── RestClientFactoryBean.java │ │ │ ├── RestClients.java │ │ │ ├── RestIndexTemplate.java │ │ │ ├── ScriptField.java │ │ │ ├── SearchDocumentResponseBuilder.java │ │ │ └── SearchHitsUtil.java │ │ └── osc │ │ │ ├── Aggregation.java │ │ │ ├── AutoCloseableOpenSearchClient.java │ │ │ ├── ChildTemplate.java │ │ │ ├── ClusterTemplate.java │ │ │ ├── CriteriaFilterProcessor.java │ │ │ ├── CriteriaQueryException.java │ │ │ ├── CriteriaQueryProcessor.java │ │ │ ├── DocumentAdapters.java │ │ │ ├── EntityAsMap.java │ │ │ ├── HighlightQueryBuilder.java │ │ │ ├── IndicesTemplate.java │ │ │ ├── JsonUtils.java │ │ │ ├── JsonpUtils.java │ │ │ ├── NativeQuery.java │ │ │ ├── NativeQueryBuilder.java │ │ │ ├── OpenSearchAggregation.java │ │ │ ├── OpenSearchAggregations.java │ │ │ ├── OpenSearchClientBeanDefinitionParser.java │ │ │ ├── OpenSearchClientFactoryBean.java │ │ │ ├── OpenSearchClients.java │ │ │ ├── OpenSearchConfiguration.java │ │ │ ├── OpenSearchExceptionTranslator.java │ │ │ ├── OpenSearchTemplate.java │ │ │ ├── Queries.java │ │ │ ├── QueryBuilders.java │ │ │ ├── RequestConverter.java │ │ │ ├── ResponseConverter.java │ │ │ ├── SearchDocumentResponseBuilder.java │ │ │ ├── TypeUtils.java │ │ │ └── package-info.java │ │ └── core │ │ ├── AbstractIndexTemplate.java │ │ └── OpenSearchOperations.java │ └── test │ ├── java │ └── org │ │ ├── opensearch │ │ └── data │ │ │ ├── client │ │ │ ├── EnabledIfOpenSearchVersion.java │ │ │ ├── EnabledIfOpenSearchVersionCondition.java │ │ │ ├── JUnit5SampleOpenSearchRestTemplateTests.java │ │ │ ├── NestedObjectORHLCIntegrationTests.java │ │ │ ├── NestedObjectOSCIntegrationTests.java │ │ │ ├── config │ │ │ │ ├── AuditingORHLCIntegrationTests.java │ │ │ │ ├── AuditingOSCIntegrationTests.java │ │ │ │ ├── OpenSearchConfigurationSupportIntegrationTests.java │ │ │ │ ├── configuration │ │ │ │ │ ├── OpenSearchConfigurationORHLCIntegrationTests.java │ │ │ │ │ └── OpenSearchConfigurationOSCIntegrationTests.java │ │ │ │ ├── nested │ │ │ │ │ ├── EnableNestedRepositoriesORHLCIntegrationTests.java │ │ │ │ │ └── EnableNestedRepositoriesOSCIntegrationTests.java │ │ │ │ └── notnested │ │ │ │ │ ├── EnableRepositoriesORHLCIntegrationTests.java │ │ │ │ │ └── EnableRepositoriesOSCIntegrationTests.java │ │ │ ├── core │ │ │ │ ├── InnerHitsORHLCIntegrationTests.java │ │ │ │ ├── InnerHitsOSCIntegrationTests.java │ │ │ │ ├── LogEntityORHLCIntegrationTests.java │ │ │ │ ├── LogEntityOSCIntegrationTests.java │ │ │ │ ├── OpenSearchRestTemplateCallbackTests.java │ │ │ │ ├── OpenSearchTemplateCallbackTests.java │ │ │ │ ├── ReindexORHLCIntegrationTests.java │ │ │ │ ├── ReindexOSCIntegrationTests.java │ │ │ │ ├── SearchAsYouTypeORHLCIntegrationTests.java │ │ │ │ ├── SearchAsYouTypeOSCIntegrationTests.java │ │ │ │ ├── SourceFilterORHLCIntegrationTests.java │ │ │ │ ├── SourceFilterOSCIntegrationTests.java │ │ │ │ ├── aggregation │ │ │ │ │ ├── AggregationORHLCIntegrationTests.java │ │ │ │ │ └── AggregationOSCIntegrationTests.java │ │ │ │ ├── cluster │ │ │ │ │ ├── ClusterOperationsORHLCIntegrationTests.java │ │ │ │ │ └── ClusterOperationsOSCIntegrationTests.java │ │ │ │ ├── document │ │ │ │ │ └── DocumentAdaptersUnitTests.java │ │ │ │ ├── event │ │ │ │ │ ├── CallbackORHLCIntegrationTests.java │ │ │ │ │ └── CallbackOSCIntegrationTests.java │ │ │ │ ├── geo │ │ │ │ │ ├── GeoJsonORHLCIntegrationTests.java │ │ │ │ │ ├── GeoJsonOSCIntegrationTests.java │ │ │ │ │ ├── GeoORHLCIntegrationTests.java │ │ │ │ │ └── GeoOSCIntegrationTests.java │ │ │ │ ├── index │ │ │ │ │ ├── IndexTemplateORHLCIntegrationTests.java │ │ │ │ │ ├── IndexTemplateOSCIntegrationTests.java │ │ │ │ │ ├── MappingBuilderORHLCIntegrationTests.java │ │ │ │ │ └── MappingBuilderOSCIntegrationTests.java │ │ │ │ ├── indices │ │ │ │ │ ├── IndexOperationsORHLCIntegrationTests.java │ │ │ │ │ ├── IndexOperationsOSCIntegrationTests.java │ │ │ │ │ └── IndexTemplateOperationsOSCIntegrationTests.java │ │ │ │ ├── mapping │ │ │ │ │ ├── EntityCustomConversionORHLCIntegrationTests.java │ │ │ │ │ ├── EntityCustomConversionOSCIntegrationTests.java │ │ │ │ │ ├── FieldNamingStrategyORHLCIntegrationTests.java │ │ │ │ │ └── FieldNamingStrategyOSCIntegrationTests.java │ │ │ │ ├── paginating │ │ │ │ │ ├── SearchAfterORHLCIntegrationTests.java │ │ │ │ │ └── SearchAfterOSCIntegrationTests.java │ │ │ │ ├── query │ │ │ │ │ ├── CriteriaQueryORHLCIntegrationTests.java │ │ │ │ │ ├── CriteriaQueryOSCIntegrationTests.java │ │ │ │ │ ├── HighlightQueryBuilderTests.java │ │ │ │ │ ├── NativeQueryOSCIntegrationTests.java │ │ │ │ │ ├── NativeSearchQueryBuilderTests.java │ │ │ │ │ └── SeqNoPrimaryTermTests.java │ │ │ │ ├── routing │ │ │ │ │ ├── RoutingORHLCIntegrationTests.java │ │ │ │ │ └── RoutingOSCIntegrationTests.java │ │ │ │ └── suggest │ │ │ │ │ ├── CompletionORHLCIntegrationTests.java │ │ │ │ │ └── CompletionOSCIntegrationTests.java │ │ │ ├── immutable │ │ │ │ ├── ImmutableRepositoryORHLCIntegrationTests.java │ │ │ │ └── ImmutableRepositoryOSCIntegrationTests.java │ │ │ ├── junit │ │ │ │ └── jupiter │ │ │ │ │ ├── OpenSearchRestTemplateConfiguration.java │ │ │ │ │ └── OpenSearchTemplateConfiguration.java │ │ │ ├── orhlc │ │ │ │ ├── ClientConfigurationIntegrationTests.java │ │ │ │ ├── OpenSearchExceptionTranslatorIntegrationTests.java │ │ │ │ ├── OpenSearchORHLCIntegrationTests.java │ │ │ │ ├── OpenSearchORHLCSpecificIntegrationTests.java │ │ │ │ ├── OpenSearchPartQueryORHLCIntegrationTests.java │ │ │ │ ├── RequestConvertersTests.java │ │ │ │ ├── RequestFactoryTests.java │ │ │ │ ├── RestClientsIntegrationTests.java │ │ │ │ └── RestClientsTest.java │ │ │ ├── osc │ │ │ │ ├── AutoCloseableOpenSearchClientTest.java │ │ │ │ ├── CriteriaQueryMappingUnitTests.java │ │ │ │ ├── CriteriaQueryProcessorUnitTests.java │ │ │ │ ├── DevTests.java │ │ │ │ ├── DocumentAdaptersUnitTests.java │ │ │ │ ├── OpenSearchOSCIntegrationTests.java │ │ │ │ ├── OpenSearchOSCSpecificIntegrationTests.java │ │ │ │ ├── OpenSearchPartQueryOSCIntegrationTests.java │ │ │ │ ├── RequestConverterTest.java │ │ │ │ └── SearchDocumentResponseBuilderUnitTests.java │ │ │ ├── repositories │ │ │ │ ├── cdi │ │ │ │ │ └── ElasticsearchOperationsProducer.java │ │ │ │ ├── complex │ │ │ │ │ └── custommethod │ │ │ │ │ │ ├── autowiring │ │ │ │ │ │ ├── ComplexCustomMethodRepositoryORHLCIntegrationTests.java │ │ │ │ │ │ └── ComplexCustomMethodRepositoryOSCIntegrationTests.java │ │ │ │ │ │ └── manualwiring │ │ │ │ │ │ ├── ComplexCustomMethodRepositoryManualWiringORHLCIntegrationTests.java │ │ │ │ │ │ └── ComplexCustomMethodRepositoryManualWiringOSCIntegrationTests.java │ │ │ │ ├── custommethod │ │ │ │ │ ├── CustomMethodRepositoryORHLCIntegrationTests.java │ │ │ │ │ └── CustomMethodRepositoryOSCIntegrationTests.java │ │ │ │ ├── doubleid │ │ │ │ │ ├── DoubleIDRepositoryORHLCIntegrationTests.java │ │ │ │ │ └── DoubleIDRepositoryOSCIntegrationTests.java │ │ │ │ ├── dynamicindex │ │ │ │ │ ├── DynamicIndexEntityORHLCIntegrationTests.java │ │ │ │ │ └── DynamicIndexEntityOSCIntegrationTests.java │ │ │ │ ├── geo │ │ │ │ │ ├── GeoRepositoryORHLCIntegrationTests.java │ │ │ │ │ └── GeoRepositoryOSCIntegrationTests.java │ │ │ │ ├── integer │ │ │ │ │ ├── IntegerIDRepositoryORHLCIntegrationTests.java │ │ │ │ │ └── IntegerIDRepositoryOSCIntegrationTests.java │ │ │ │ ├── nestedobject │ │ │ │ │ ├── InnerObjectORHLCIntegrationTests.java │ │ │ │ │ └── InnerObjectOSCIntegrationTests.java │ │ │ │ ├── setting │ │ │ │ │ ├── dynamic │ │ │ │ │ │ ├── DynamicSettingAndMappingEntityRepositoryORHLCIntegrationTests.java │ │ │ │ │ │ └── DynamicSettingAndMappingEntityRepositoryOSCIntegrationTests.java │ │ │ │ │ └── fielddynamic │ │ │ │ │ │ ├── FieldDynamicMappingEntityRepositoryORHLCIntegrationTests.java │ │ │ │ │ │ └── FieldDynamicMappingEntityRepositoryOSCIntegrationTests.java │ │ │ │ ├── spel │ │ │ │ │ ├── SpELEntityORHLCIntegrationTests.java │ │ │ │ │ └── SpELEntityOSCIntegrationTests.java │ │ │ │ ├── synonym │ │ │ │ │ ├── SynonymRepositoryORHLCIntegrationTests.java │ │ │ │ │ └── SynonymRepositoryOSCIntegrationTests.java │ │ │ │ └── uuidkeyed │ │ │ │ │ ├── UUIDElasticsearchRepositoryORHLCIntegrationTests.java │ │ │ │ │ └── UUIDElasticsearchRepositoryOSCIntegrationTests.java │ │ │ └── repository │ │ │ │ ├── query │ │ │ │ └── keywords │ │ │ │ │ ├── QueryKeywordsORHLCIntegrationTests.java │ │ │ │ │ └── QueryKeywordsOSCIntegrationTests.java │ │ │ │ └── support │ │ │ │ ├── ElasticsearchRepositoryORHLCIntegrationTests.java │ │ │ │ └── ElasticsearchRepositoryOSCIntegrationTests.java │ │ │ └── core │ │ │ └── OpenSearchSpecificIntegrationTests.java │ │ └── springframework │ │ └── data │ │ └── elasticsearch │ │ ├── NestedObjectIntegrationTests.java │ │ ├── config │ │ ├── AuditingIntegrationTests.java │ │ ├── nested │ │ │ └── EnableNestedRepositoriesIntegrationTests.java │ │ └── notnested │ │ │ ├── EnableRepositoriesIntegrationTests.java │ │ │ ├── SampleElasticsearchRepository.java │ │ │ ├── SampleUUIDKeyedElasticsearchRepository.java │ │ │ └── package-info.java │ │ ├── core │ │ ├── ElasticsearchIntegrationTests.java │ │ ├── InnerHitsIntegrationTests.java │ │ ├── LogEntityIntegrationTests.java │ │ ├── MappingContextBaseTests.java │ │ ├── ReindexIntegrationTests.java │ │ ├── SearchAsYouTypeIntegrationTests.java │ │ ├── SourceFilterIntegrationTests.java │ │ ├── aggregation │ │ │ └── AggregationIntegrationTests.java │ │ ├── cluster │ │ │ └── ClusterOperationsIntegrationTests.java │ │ ├── event │ │ │ └── CallbackIntegrationTests.java │ │ ├── geo │ │ │ ├── GeoIntegrationTests.java │ │ │ ├── GeoJsonEntity.java │ │ │ └── GeoJsonIntegrationTests.java │ │ ├── index │ │ │ ├── IndexTemplateIntegrationTests.java │ │ │ └── MappingBuilderIntegrationTests.java │ │ ├── indices │ │ │ └── IndexOperationsIntegrationTests.java │ │ ├── mapping │ │ │ ├── EntityCustomConversionIntegrationTests.java │ │ │ └── FieldNamingStrategyIntegrationTests.java │ │ ├── paginating │ │ │ ├── SearchAfterIntegrationTests.java │ │ │ └── package-info.java │ │ ├── query │ │ │ ├── CriteriaQueryIntegrationTests.java │ │ │ ├── ElasticsearchPartQueryIntegrationTests.java │ │ │ └── NativeQueryIntegrationTests.java │ │ ├── routing │ │ │ └── RoutingIntegrationTests.java │ │ └── suggest │ │ │ └── CompletionIntegrationTests.java │ │ ├── immutable │ │ └── ImmutableRepositoryIntegrationTests.java │ │ ├── junit │ │ └── jupiter │ │ │ ├── ClusterConnection.java │ │ │ ├── ClusterConnectionException.java │ │ │ ├── ClusterConnectionInfo.java │ │ │ ├── IntegrationTest.java │ │ │ ├── IntegrationtestEnvironment.java │ │ │ ├── SpringDataElasticsearchExtension.java │ │ │ ├── SpringIntegrationTest.java │ │ │ ├── Tags.java │ │ │ └── package-info.java │ │ ├── repositories │ │ ├── cdi │ │ │ ├── CdiProductRepository.java │ │ │ ├── CdiRepositoryClient.java │ │ │ ├── CdiRepositoryTests.java │ │ │ ├── OtherQualifier.java │ │ │ ├── PersonDB.java │ │ │ ├── QualifiedProductRepository.java │ │ │ ├── SamplePersonRepository.java │ │ │ ├── SamplePersonRepositoryCustom.java │ │ │ ├── SamplePersonRepositoryImpl.java │ │ │ └── package-info.java │ │ ├── complex │ │ │ └── custommethod │ │ │ │ ├── autowiring │ │ │ │ ├── ComplexCustomMethodRepositoryIntegrationTests.java │ │ │ │ ├── ComplexElasticsearchRepository.java │ │ │ │ ├── ComplexElasticsearchRepositoryCustom.java │ │ │ │ └── ComplexElasticsearchRepositoryImpl.java │ │ │ │ └── manualwiring │ │ │ │ ├── ComplexCustomMethodRepositoryManualWiringIntegrationTests.java │ │ │ │ ├── ComplexElasticsearchRepositoryCustom.java │ │ │ │ ├── ComplexElasticsearchRepositoryManualWiring.java │ │ │ │ └── ComplexElasticsearchRepositoryManualWiringImpl.java │ │ ├── custommethod │ │ │ └── CustomMethodRepositoryIntegrationTests.java │ │ ├── doubleid │ │ │ └── DoubleIDRepositoryIntegrationTests.java │ │ ├── dynamicindex │ │ │ └── DynamicIndexEntityIntegrationTests.java │ │ ├── geo │ │ │ └── GeoRepositoryIntegrationTests.java │ │ ├── integer │ │ │ └── IntegerIDRepositoryIntegrationTests.java │ │ ├── nestedobject │ │ │ └── InnerObjectIntegrationTests.java │ │ ├── setting │ │ │ ├── dynamic │ │ │ │ └── DynamicSettingAndMappingEntityRepositoryIntegrationTests.java │ │ │ └── fielddynamic │ │ │ │ └── FieldDynamicMappingEntityRepositoryIntegrationTests.java │ │ ├── spel │ │ │ └── SpELEntityIntegrationTests.java │ │ ├── synonym │ │ │ └── SynonymRepositoryIntegrationTests.java │ │ └── uuidkeyed │ │ │ └── UUIDElasticsearchRepositoryIntegrationTests.java │ │ ├── repository │ │ ├── query │ │ │ └── keywords │ │ │ │ └── QueryKeywordsIntegrationTests.java │ │ └── support │ │ │ └── ElasticsearchRepositoryIntegrationTests.java │ │ └── utils │ │ ├── IdGenerator.java │ │ ├── IndexBuilder.java │ │ ├── IndexInitializer.java │ │ ├── IndexNameProvider.java │ │ └── geohash │ │ ├── BitUtil.java │ │ ├── Geohash.java │ │ ├── Geometry.java │ │ ├── GeometryValidator.java │ │ ├── GeometryVisitor.java │ │ ├── Point.java │ │ ├── Rectangle.java │ │ ├── ShapeType.java │ │ ├── StandardValidator.java │ │ ├── WellKnownText.java │ │ └── package-info.java │ └── resources │ ├── META-INF │ ├── beans.xml │ └── spring.factories │ ├── highlights │ ├── highlights-with-parameters.json │ └── highlights.json │ ├── local-maven-repo │ └── org │ │ └── projectlombok │ │ └── lombok │ │ ├── 999999 │ │ ├── lombok-999999.jar │ │ ├── lombok-999999.jar.md5 │ │ ├── lombok-999999.jar.sha1 │ │ ├── lombok-999999.pom │ │ ├── lombok-999999.pom.md5 │ │ └── lombok-999999.pom.sha1 │ │ ├── maven-metadata.xml │ │ ├── maven-metadata.xml.md5 │ │ └── maven-metadata.xml.sha1 │ ├── log4j2.xml │ ├── logback.xml │ ├── mappings │ ├── test-dynamic_templates_mappings.json │ ├── test-dynamic_templates_mappings_two.json │ ├── test-field-analyzed-mappings.json │ ├── test-field-mappings.json │ └── test-mappings.json │ ├── mockito-extensions │ └── org.mockito.plugins.MockMaker │ ├── node-client-configuration.yml │ ├── org │ └── springframework │ │ └── data │ │ └── elasticsearch │ │ └── client │ │ ├── aggregate-ok-multiple-results.json │ │ ├── aggregate-ok-no-results.json │ │ ├── aggregate-ok-single-result.json │ │ ├── bulk-ok.json │ │ ├── get-by-id-no-hit.json │ │ ├── get-by-id-ok.json │ │ ├── index-ok-created.json │ │ ├── index-ok-updated.json │ │ ├── info.json │ │ ├── multi-get-ok-2-hits-1-unavailable.json │ │ ├── multi-get-ok-2-hits.json │ │ ├── scroll_clean.json │ │ ├── scroll_error.json │ │ ├── scroll_no_more_results.json │ │ ├── scroll_ok.json │ │ ├── search-ok-multiple-hits.json │ │ ├── search-ok-no-hits.json │ │ ├── search-ok-scroll.json │ │ ├── search-ok-single-hit.json │ │ ├── update-error-not-found.json │ │ ├── update-ok-deleted.json │ │ └── update-ok-updated.json │ ├── settings │ ├── test-normalizer.json │ ├── test-settings.json │ └── test-settings.yml │ ├── synonyms │ ├── mappings.json │ ├── settings-with-external-file.json │ ├── settings.json │ └── synonyms.txt │ └── testcontainers-opensearch.properties └── version.properties /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # This should match the list of maintainers in MAINTAINERS.md 2 | * @reta @dlvenable @andrross 3 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "gradle" 4 | directory: "/" 5 | schedule: 6 | interval: "weekly" 7 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | ### Description 2 | [Describe what this change achieves] 3 | 4 | ### Issues Resolved 5 | [List any issues this PR will resolve] 6 | 7 | ### Check List 8 | - [ ] New functionality includes testing. 9 | - [ ] All tests pass 10 | - [ ] New functionality has been documented. 11 | - [ ] New functionality has javadoc added 12 | - [ ] Commits are signed per the DCO using --signoff 13 | 14 | By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license. 15 | For more information on following Developer Certificate of Origin and signing off your commits, please check [here](https://github.com/opensearch-project/OpenSearch/blob/main/CONTRIBUTING.md#developer-certificate-of-origin). 16 | -------------------------------------------------------------------------------- /.github/workflows/add-untriaged.yml: -------------------------------------------------------------------------------- 1 | name: Apply 'untriaged' label during issue lifecycle 2 | 3 | on: 4 | issues: 5 | types: [opened, reopened, transferred] 6 | 7 | jobs: 8 | apply-label: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: actions/github-script@v6 12 | with: 13 | script: | 14 | github.rest.issues.addLabels({ 15 | issue_number: context.issue.number, 16 | owner: context.repo.owner, 17 | repo: context.repo.repo, 18 | labels: ['untriaged'] 19 | }) 20 | -------------------------------------------------------------------------------- /.github/workflows/publish-snapshots.yml: -------------------------------------------------------------------------------- 1 | name: Publish snapshots to maven 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | 8 | jobs: 9 | build-and-publish-snapshots: 10 | runs-on: ubuntu-latest 11 | permissions: 12 | id-token: write 13 | contents: write 14 | steps: 15 | - uses: actions/checkout@v3 16 | - name: Set up JDK 11 17 | uses: actions/setup-java@v3 18 | with: 19 | java-version: 17 20 | distribution: 'temurin' 21 | - name: Configure AWS credentials 22 | uses: aws-actions/configure-aws-credentials@v1 23 | with: 24 | role-to-assume: ${{ secrets.PUBLISH_SNAPSHOTS_ROLE }} 25 | aws-region: us-east-1 26 | - name: publish snapshots to Apache Maven repositories 27 | run: | 28 | export SONATYPE_USERNAME=$(aws secretsmanager get-secret-value --secret-id maven-snapshots-username --query SecretString --output text) 29 | export SONATYPE_PASSWORD=$(aws secretsmanager get-secret-value --secret-id maven-snapshots-password --query SecretString --output text) 30 | echo "::add-mask::$SONATYPE_USERNAME" 31 | echo "::add-mask::$SONATYPE_PASSWORD" 32 | ./gradlew --no-daemon publishPublishMavenPublicationToSnapshotsRepository 33 | -------------------------------------------------------------------------------- /.github/workflows/release-drafter.yml: -------------------------------------------------------------------------------- 1 | name: Release drafter 2 | 3 | # Push events to every tag not containing "/" 4 | on: 5 | push: 6 | tags: 7 | - "*" 8 | 9 | jobs: 10 | draft-a-release: 11 | name: Draft a release 12 | runs-on: ubuntu-latest 13 | steps: 14 | - name: Checkout code 15 | uses: actions/checkout@v3 16 | - id: get_data 17 | run: | 18 | echo "approvers=$(cat .github/CODEOWNERS | grep @ | tr -d '*\n ' | sed 's/@/,/g' | sed 's/,//1')" >> $GITHUB_OUTPUT 19 | echo "version=$(cat version.properties)" >> $GITHUB_OUTPUT 20 | - uses: trstringer/manual-approval@v1 21 | with: 22 | secret: ${{ github.TOKEN }} 23 | approvers: ${{ steps.get_data.outputs.approvers }} 24 | minimum-approvals: 1 25 | issue-title: 'Release spring-data-opensearch ${{ steps.get_data.outputs.version }}' 26 | issue-body: "Please approve or deny the release of spring-data-opensearch **TAG**: ${{ github.ref_name }} **COMMIT**: ${{ github.sha }} **VERSION** : ${{ steps.get_data.outputs.version }} " 27 | exclude-workflow-initiator-as-approver: true 28 | - name: Set up JDK 17 29 | uses: actions/setup-java@v3 30 | with: 31 | java-version: 17 32 | distribution: 'temurin' 33 | cache: gradle 34 | - name: Build with Gradle 35 | run: | 36 | ./gradlew --no-daemon -Dbuild.snapshot=false publishPublishMavenPublicationToLocalRepoRepository && tar -C build -cvf artifacts.tar.gz repository 37 | - name: Draft a release 38 | uses: softprops/action-gh-release@v1 39 | with: 40 | draft: true 41 | generate_release_notes: true 42 | files: | 43 | artifacts.tar.gz 44 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | *.graphml 3 | .springBeans 4 | .gradle 5 | build/ 6 | 7 | atlassian-ide-plugin.xml 8 | 9 | ## Ignore svn files 10 | .svn 11 | 12 | ## ignore any target dir 13 | target 14 | 15 | ## Ignore project files created by Eclipse 16 | .settings 17 | .project 18 | .classpath 19 | 20 | ## Ignore project files created by IntelliJ IDEA 21 | *.iml 22 | *.ipr 23 | *.iws 24 | .idea 25 | /.env 26 | 27 | 28 | /zap.env 29 | -------------------------------------------------------------------------------- /.whitesource: -------------------------------------------------------------------------------- 1 | { 2 | "scanSettings": { 3 | "configMode": "AUTO", 4 | "configExternalURL": "", 5 | "projectToken": "", 6 | "baseBranches": [] 7 | }, 8 | "checkRunSettings": { 9 | "vulnerableCheckRunConclusionLevel": "failure", 10 | "displayMode": "diff", 11 | "useMendCheckNames": true 12 | }, 13 | "issueSettings": { 14 | "minSeverityLevel": "LOW", 15 | "issueType": "DEPENDENCY" 16 | }, 17 | "remediateSettings": { 18 | "workflowRules": { 19 | "enabled": true 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | ## Code of Conduct 2 | This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct). 3 | For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact 4 | opensource-codeofconduct@amazon.com with any additional questions or comments. 5 | -------------------------------------------------------------------------------- /MAINTAINERS.md: -------------------------------------------------------------------------------- 1 | ## Overview 2 | 3 | This document contains a list of maintainers in this repo. See [opensearch-project/.github/RESPONSIBILITIES.md](https://github.com/opensearch-project/.github/blob/main/RESPONSIBILITIES.md#maintainer-responsibilities) that explains what the role of maintainer means, what maintainers do in this and other repos, and how they should be doing it. If you're interested in contributing, and becoming a maintainer, see [CONTRIBUTING](CONTRIBUTING.md). 4 | 5 | ## Current Maintainers 6 | 7 | | Maintainer | GitHub ID | Affiliation | 8 | | ------------- | ----------------------------------------- | ----------- | 9 | | Andriy Redko | [reta](https://github.com/reta) | Independent | 10 | | David Venable | [dlvenable](https://github.com/dlvenable) | Amazon | 11 | | Andrew Ross | [andrross](https://github.com/andrross) | Amazon | 12 | 13 | ## Emeritus 14 | 15 | | Maintainer | GitHub ID | Affiliation | 16 | | ------------------ | ----------------------------------- | ----------- | 17 | | Daniel Doubrovkine | [dblock](https://github.com/dblock) | Independent | 18 | -------------------------------------------------------------------------------- /NOTICE.txt: -------------------------------------------------------------------------------- 1 | Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | 3 | This product includes software developed at 4 | The Apache Software Foundation (http://www.apache.org/). 5 | 6 | This product includes/uses Spring Data Elasticsearch (https://github.com/spring-projects/spring-data-elasticsearch), 7 | developed by the Spring team (https://github.com/spring-projects) 8 | -------------------------------------------------------------------------------- /build.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors. 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | import net.researchgate.release.ReleaseExtension 7 | 8 | plugins { 9 | java 10 | eclipse 11 | idea 12 | `test-report-aggregation` 13 | `jacoco-report-aggregation` 14 | alias(pluginLibs.plugins.release) 15 | } 16 | 17 | buildscript { 18 | dependencies { 19 | classpath(pluginLibs.release) 20 | } 21 | } 22 | 23 | configure { 24 | with(git) { 25 | requireBranch.set("main") 26 | } 27 | } 28 | 29 | dependencies { 30 | testReportAggregation(project(":spring-data-opensearch")) 31 | testReportAggregation(project(":spring-data-opensearch-starter")) 32 | } 33 | 34 | tasks.check { 35 | dependsOn(tasks.named("testAggregateTestReport")) 36 | } 37 | -------------------------------------------------------------------------------- /buildSrc/build.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors. 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | plugins { 7 | `kotlin-dsl` 8 | } 9 | 10 | repositories { 11 | gradlePluginPortal() 12 | } 13 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.warning.mode=all 2 | 3 | org.gradle.jvmargs=--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED \ 4 | --add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED \ 5 | --add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED \ 6 | --add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED \ 7 | --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED 8 | 9 | sde.testcontainers.image-version=2.19.2 10 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opensearch-project/spring-data-opensearch/6fd3cd3f501554b08df31958aea8e6f8821c8813/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionSha256Sum=61ad310d3c7d3e5da131b76bbf22b5a4c0786e9d892dae8c1658d4b484de3caa 7 | -------------------------------------------------------------------------------- /jenkins/release.jenkinsFile: -------------------------------------------------------------------------------- 1 | lib = library(identifier: 'jenkins@1.5.3', retriever: modernSCM([ 2 | $class: 'GitSCMSource', 3 | remote: 'https://github.com/opensearch-project/opensearch-build-libraries.git', 4 | ])) 5 | 6 | standardReleasePipelineWithGenericTrigger( 7 | overrideDockerImage: 'opensearchstaging/ci-runner:release-centos7-clients-v4', 8 | tokenIdCredential: 'jenkins-spring-data-opensearch-generic-webhook-token', 9 | causeString: 'A tag was cut on opensearch-project/spring-data-opensearch repository causing this workflow to run', 10 | downloadReleaseAsset: true, 11 | publishRelease: true) { 12 | publishToMaven( 13 | signingArtifactsPath: "$WORKSPACE/repository/", 14 | mavenArtifactsPath: "$WORKSPACE/repository/", 15 | autoPublish: true 16 | ) 17 | } 18 | -------------------------------------------------------------------------------- /spring-data-opensearch-docker-compose/src/main/java/org/opensearch/spring/boot/docker/compose/service/connection/OpenSearchEnvironment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors. 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.spring.boot.docker.compose.service.connection; 7 | 8 | import java.util.Map; 9 | 10 | class OpenSearchEnvironment { 11 | 12 | private final String username = "admin"; 13 | 14 | private final boolean securityEnabled; 15 | 16 | private final String password; 17 | 18 | OpenSearchEnvironment(Map env) { 19 | this.securityEnabled = !Boolean.parseBoolean(env.get("DISABLE_SECURITY_PLUGIN")); 20 | this.password = env.getOrDefault("OPENSEARCH_INITIAL_ADMIN_PASSWORD", "admin"); 21 | } 22 | 23 | public String getUsername() { 24 | return this.username; 25 | } 26 | 27 | public boolean isSecurityEnabled() { 28 | return this.securityEnabled; 29 | } 30 | 31 | public String getPassword() { 32 | return this.password; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /spring-data-opensearch-docker-compose/src/main/resources/META-INF/spring.factories: -------------------------------------------------------------------------------- 1 | org.springframework.boot.autoconfigure.service.connection.ConnectionDetailsFactory=\ 2 | org.opensearch.spring.boot.docker.compose.service.connection.OpenSearchDockerComposeConnectionDetailsFactory -------------------------------------------------------------------------------- /spring-data-opensearch-docker-compose/src/test/resources/org/opensearch/spring/boot/docker/compose/service/connection/opensearch-compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | opensearch: 3 | image: opensearchproject/opensearch:2.15.0 4 | ports: 5 | - '9200' 6 | environment: 7 | - 'discovery.type=single-node' 8 | - 'DISABLE_SECURITY_PLUGIN=true' 9 | -------------------------------------------------------------------------------- /spring-data-opensearch-docker-compose/src/test/resources/org/opensearch/spring/boot/docker/compose/service/connection/secure-opensearch-compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | opensearch: 3 | image: opensearchproject/opensearch:2.15.0 4 | ports: 5 | - '9200' 6 | healthcheck: 7 | test: ["CMD-SHELL", "curl -k -u admin:D3v3l0p-ment --silent --fail https://localhost:9200/ || exit 1"] 8 | interval: 10s 9 | timeout: 10s 10 | retries: 3 11 | environment: 12 | - 'discovery.type=single-node' 13 | - 'OPENSEARCH_INITIAL_ADMIN_PASSWORD=D3v3l0p-ment' 14 | -------------------------------------------------------------------------------- /spring-data-opensearch-examples/spring-boot-gradle/build.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors. 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | plugins { 7 | alias(springLibs.plugins.spring.boot) 8 | alias(pluginLibs.plugins.spotless) 9 | alias(pluginLibs.plugins.editorconfig) 10 | id("java-conventions") 11 | } 12 | 13 | buildscript { 14 | dependencies { 15 | classpath(pluginLibs.editorconfig) 16 | classpath(pluginLibs.spotless) 17 | } 18 | } 19 | 20 | dependencies { 21 | api(project(":spring-data-opensearch")) 22 | api(project(":spring-data-opensearch-starter")) 23 | implementation(springLibs.boot.web) 24 | implementation(jacksonLibs.core) 25 | implementation(jacksonLibs.databind) 26 | implementation(opensearchLibs.client) { 27 | exclude("commons-logging", "commons-logging") 28 | exclude("org.slf4j", "slf4j-api") 29 | } 30 | testImplementation(springLibs.test) 31 | testImplementation(springLibs.boot.test) 32 | testImplementation(springLibs.boot.test.autoconfigure) 33 | testImplementation(springLibs.boot.testcontainers) 34 | testImplementation(opensearchLibs.testcontainers) 35 | testImplementation(project(":spring-data-opensearch-testcontainers")) 36 | testImplementation(project(":spring-data-opensearch-test-autoconfigure")) 37 | 38 | constraints { 39 | implementation("ch.qos.logback:logback-classic") { 40 | version { 41 | require("1.4.12") 42 | } 43 | because("Fixes CVE-2023-6378") 44 | } 45 | } 46 | } 47 | 48 | description = "Spring Data OpenSearch Spring Boot Example Project" 49 | 50 | spotless { 51 | java { 52 | target("src/main/java/**/*.java", "src/test/java/org/opensearch/**/*.java") 53 | 54 | trimTrailingWhitespace() 55 | indentWithSpaces() 56 | endWithNewline() 57 | 58 | removeUnusedImports() 59 | importOrder() 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /spring-data-opensearch-examples/spring-boot-gradle/src/main/java/org/opensearch/data/example/MarketplaceApplication.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors. 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.data.example; 7 | 8 | import org.springframework.boot.SpringApplication; 9 | import org.springframework.boot.autoconfigure.SpringBootApplication; 10 | import org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchDataAutoConfiguration; 11 | 12 | @SpringBootApplication(exclude = ElasticsearchDataAutoConfiguration.class) 13 | public class MarketplaceApplication { 14 | public static void main(String[] args) { 15 | SpringApplication.run(MarketplaceConfiguration.class, args); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /spring-data-opensearch-examples/spring-boot-gradle/src/main/java/org/opensearch/data/example/repository/MarketplaceRepository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors. 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.data.example.repository; 7 | 8 | import java.math.BigDecimal; 9 | import java.util.List; 10 | import org.opensearch.data.example.model.Product; 11 | import org.springframework.data.elasticsearch.repository.ElasticsearchRepository; 12 | import org.springframework.stereotype.Repository; 13 | 14 | /** 15 | * See please https://github.com/spring-projects/spring-data-elasticsearch/blob/main/src/main/asciidoc/reference/elasticsearch-repository-queries.adoc 16 | */ 17 | @Repository 18 | public interface MarketplaceRepository extends ElasticsearchRepository { 19 | List findByNameLikeAndPriceGreaterThan(String name, BigDecimal price); 20 | } 21 | -------------------------------------------------------------------------------- /spring-data-opensearch-examples/spring-boot-gradle/src/main/java/org/opensearch/data/example/rest/MarketplaceRestController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors. 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.data.example.rest; 7 | 8 | import java.math.BigDecimal; 9 | import java.util.List; 10 | import org.opensearch.data.example.model.Product; 11 | import org.opensearch.data.example.repository.MarketplaceRepository; 12 | import org.springframework.http.MediaType; 13 | import org.springframework.web.bind.annotation.GetMapping; 14 | import org.springframework.web.bind.annotation.RequestMapping; 15 | import org.springframework.web.bind.annotation.RequestParam; 16 | import org.springframework.web.bind.annotation.RestController; 17 | 18 | @RestController 19 | @RequestMapping("/marketplace") 20 | public class MarketplaceRestController { 21 | private final MarketplaceRepository repository; 22 | 23 | public MarketplaceRestController(MarketplaceRepository repository) { 24 | this.repository = repository; 25 | } 26 | 27 | @GetMapping(value = "/search", produces = MediaType.APPLICATION_JSON_VALUE) 28 | public List search( 29 | @RequestParam(value = "name", required = false, defaultValue = "") String name, 30 | @RequestParam(value = "price", required = false, defaultValue = "0.0") BigDecimal price) { 31 | return repository.findByNameLikeAndPriceGreaterThan(name, price); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /spring-data-opensearch-examples/spring-boot-gradle/src/main/java/org/opensearch/data/example/service/MarketplaceInitializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors. 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.data.example.service; 7 | 8 | import java.math.BigDecimal; 9 | import org.opensearch.data.example.model.Product; 10 | import org.opensearch.data.example.repository.MarketplaceRepository; 11 | import org.springframework.beans.factory.InitializingBean; 12 | import org.springframework.stereotype.Service; 13 | 14 | @Service 15 | public class MarketplaceInitializer implements InitializingBean { 16 | private final MarketplaceRepository repository; 17 | 18 | public MarketplaceInitializer(MarketplaceRepository repository) { 19 | this.repository = repository; 20 | } 21 | 22 | @Override 23 | public void afterPropertiesSet() throws Exception { 24 | repository.save(new Product( 25 | "1", 26 | "Utopia Bedding Bed Pillows", 27 | new BigDecimal(39.99), 28 | 2, 29 | "These professionally finished pillows, with high thread counts, provide great comfort against your skin along with added durability " 30 | + "that easily resists wear and tear to ensure a finished look for your bedroom.", 31 | "Utopia Bedding")); 32 | 33 | repository.save(new Product( 34 | "2", 35 | "Echo Dot Smart speaker", 36 | new BigDecimal(34.99), 37 | 10, 38 | "Our most popular smart speaker with a fabric design. It is our most compact smart speaker that fits perfectly into small spaces.", 39 | "Amazon")); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /spring-data-opensearch-examples/spring-boot-gradle/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright OpenSearch Contributors. 3 | # SPDX-License-Identifier: Apache-2.0 4 | # 5 | 6 | opensearch: 7 | uris: https://localhost:9200 8 | username: admin 9 | password: admin 10 | 11 | spring: 12 | jackson: 13 | serialization: 14 | INDENT_OUTPUT: true 15 | -------------------------------------------------------------------------------- /spring-data-opensearch-examples/spring-boot-gradle/src/test/java/org/opensearch/data/example/repository/MarketplaceRepositoryIntegrationTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors. 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.data.example.repository; 7 | 8 | import static org.assertj.core.api.Assertions.assertThat; 9 | 10 | import java.time.Duration; 11 | import org.junit.jupiter.api.Tag; 12 | import org.junit.jupiter.api.Test; 13 | import org.opensearch.spring.boot.autoconfigure.test.DataOpenSearchTest; 14 | import org.opensearch.testcontainers.OpensearchContainer; 15 | import org.springframework.beans.factory.annotation.Autowired; 16 | import org.springframework.boot.testcontainers.service.connection.ServiceConnection; 17 | import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories; 18 | import org.testcontainers.junit.jupiter.Container; 19 | import org.testcontainers.junit.jupiter.Testcontainers; 20 | 21 | @Testcontainers(disabledWithoutDocker = true) 22 | @DataOpenSearchTest 23 | @EnableElasticsearchRepositories(basePackageClasses = MarketplaceRepository.class) 24 | @Tag("integration-test") 25 | public class MarketplaceRepositoryIntegrationTests { 26 | @Container 27 | @ServiceConnection 28 | static final OpensearchContainer opensearch = new OpensearchContainer<>("opensearchproject/opensearch:2.19.1") 29 | .withStartupAttempts(5) 30 | .withStartupTimeout(Duration.ofMinutes(2)); 31 | 32 | @Test 33 | void testMarketplaceRepository(@Autowired MarketplaceRepository repository) { 34 | assertThat(repository.findAll()).isEmpty(); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /spring-data-opensearch-examples/spring-boot-gradle/src/test/java/org/opensearch/data/example/repository/TestMarketplaceApplication.java: -------------------------------------------------------------------------------- 1 | package org.opensearch.data.example.repository; 2 | 3 | import org.opensearch.data.example.MarketplaceApplication; 4 | import org.opensearch.testcontainers.OpensearchContainer; 5 | import org.springframework.boot.SpringApplication; 6 | import org.springframework.boot.test.context.TestConfiguration; 7 | import org.springframework.boot.testcontainers.service.connection.ServiceConnection; 8 | import org.springframework.context.annotation.Bean; 9 | 10 | public class TestMarketplaceApplication { 11 | 12 | public static void main(String[] args) { 13 | SpringApplication.from(MarketplaceApplication::main) 14 | .with(ContainerConfig.class) 15 | .run(args); 16 | } 17 | 18 | @TestConfiguration(proxyBeanMethods = false) 19 | static class ContainerConfig { 20 | 21 | @Bean 22 | @ServiceConnection 23 | OpensearchContainer opensearchContainer() { 24 | return new OpensearchContainer<>("opensearchproject/opensearch:2.19.1"); 25 | } 26 | 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /spring-data-opensearch-examples/spring-boot-java-client-gradle/src/main/java/org/opensearch/data/example/MarketplaceApplication.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors. 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.data.example; 7 | 8 | import org.springframework.boot.SpringApplication; 9 | import org.springframework.boot.autoconfigure.SpringBootApplication; 10 | import org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchDataAutoConfiguration; 11 | 12 | @SpringBootApplication(exclude = ElasticsearchDataAutoConfiguration.class) 13 | public class MarketplaceApplication { 14 | public static void main(String[] args) { 15 | SpringApplication.run(MarketplaceConfiguration.class, args); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /spring-data-opensearch-examples/spring-boot-java-client-gradle/src/main/java/org/opensearch/data/example/repository/MarketplaceRepository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors. 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.data.example.repository; 7 | 8 | import java.math.BigDecimal; 9 | import java.util.List; 10 | import org.opensearch.data.example.model.Product; 11 | import org.springframework.data.elasticsearch.repository.ElasticsearchRepository; 12 | import org.springframework.stereotype.Repository; 13 | 14 | /** 15 | * See please https://github.com/spring-projects/spring-data-elasticsearch/blob/main/src/main/asciidoc/reference/elasticsearch-repository-queries.adoc 16 | */ 17 | @Repository 18 | public interface MarketplaceRepository extends ElasticsearchRepository { 19 | List findByNameLikeAndPriceGreaterThan(String name, BigDecimal price); 20 | } 21 | -------------------------------------------------------------------------------- /spring-data-opensearch-examples/spring-boot-java-client-gradle/src/main/java/org/opensearch/data/example/rest/MarketplaceRestController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors. 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.data.example.rest; 7 | 8 | import java.math.BigDecimal; 9 | import java.util.List; 10 | import org.opensearch.data.example.model.Product; 11 | import org.opensearch.data.example.repository.MarketplaceRepository; 12 | import org.springframework.http.MediaType; 13 | import org.springframework.web.bind.annotation.GetMapping; 14 | import org.springframework.web.bind.annotation.RequestMapping; 15 | import org.springframework.web.bind.annotation.RequestParam; 16 | import org.springframework.web.bind.annotation.RestController; 17 | 18 | @RestController 19 | @RequestMapping("/marketplace") 20 | public class MarketplaceRestController { 21 | private final MarketplaceRepository repository; 22 | 23 | public MarketplaceRestController(MarketplaceRepository repository) { 24 | this.repository = repository; 25 | } 26 | 27 | @GetMapping(value = "/search", produces = MediaType.APPLICATION_JSON_VALUE) 28 | public List search( 29 | @RequestParam(value = "name", required = false, defaultValue = "") String name, 30 | @RequestParam(value = "price", required = false, defaultValue = "0.0") BigDecimal price) { 31 | return repository.findByNameLikeAndPriceGreaterThan(name, price); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /spring-data-opensearch-examples/spring-boot-java-client-gradle/src/main/java/org/opensearch/data/example/service/MarketplaceInitializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors. 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.data.example.service; 7 | 8 | import java.math.BigDecimal; 9 | import org.opensearch.data.example.model.Product; 10 | import org.opensearch.data.example.repository.MarketplaceRepository; 11 | import org.springframework.beans.factory.InitializingBean; 12 | import org.springframework.stereotype.Service; 13 | 14 | @Service 15 | public class MarketplaceInitializer implements InitializingBean { 16 | private final MarketplaceRepository repository; 17 | 18 | public MarketplaceInitializer(MarketplaceRepository repository) { 19 | this.repository = repository; 20 | } 21 | 22 | @Override 23 | public void afterPropertiesSet() throws Exception { 24 | repository.save(new Product( 25 | "1", 26 | "Utopia Bedding Bed Pillows", 27 | new BigDecimal(39.99), 28 | 2, 29 | "These professionally finished pillows, with high thread counts, provide great comfort against your skin along with added durability " 30 | + "that easily resists wear and tear to ensure a finished look for your bedroom.", 31 | "Utopia Bedding")); 32 | 33 | repository.save(new Product( 34 | "2", 35 | "Echo Dot Smart speaker", 36 | new BigDecimal(34.99), 37 | 10, 38 | "Our most popular smart speaker with a fabric design. It is our most compact smart speaker that fits perfectly into small spaces.", 39 | "Amazon")); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /spring-data-opensearch-examples/spring-boot-java-client-gradle/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright OpenSearch Contributors. 3 | # SPDX-License-Identifier: Apache-2.0 4 | # 5 | 6 | opensearch: 7 | uris: https://localhost:9200 8 | username: admin 9 | password: admin 10 | 11 | spring: 12 | jackson: 13 | serialization: 14 | INDENT_OUTPUT: true 15 | -------------------------------------------------------------------------------- /spring-data-opensearch-examples/spring-boot-java-client-gradle/src/test/java/org/opensearch/data/example/repository/MarketplaceRepositoryIntegrationTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors. 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.data.example.repository; 7 | 8 | import static org.assertj.core.api.Assertions.assertThat; 9 | 10 | import java.time.Duration; 11 | import org.junit.jupiter.api.Tag; 12 | import org.junit.jupiter.api.Test; 13 | import org.opensearch.spring.boot.autoconfigure.test.DataOpenSearchTest; 14 | import org.opensearch.testcontainers.OpensearchContainer; 15 | import org.springframework.beans.factory.annotation.Autowired; 16 | import org.springframework.boot.testcontainers.service.connection.ServiceConnection; 17 | import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories; 18 | import org.testcontainers.junit.jupiter.Container; 19 | import org.testcontainers.junit.jupiter.Testcontainers; 20 | 21 | @Testcontainers(disabledWithoutDocker = true) 22 | @DataOpenSearchTest 23 | @EnableElasticsearchRepositories(basePackageClasses = MarketplaceRepository.class) 24 | @Tag("integration-test") 25 | public class MarketplaceRepositoryIntegrationTests { 26 | @Container 27 | @ServiceConnection 28 | static final OpensearchContainer opensearch = new OpensearchContainer<>("opensearchproject/opensearch:2.19.1") 29 | .withStartupAttempts(5) 30 | .withStartupTimeout(Duration.ofMinutes(2)); 31 | 32 | @Test 33 | void testMarketplaceRepository(@Autowired MarketplaceRepository repository) { 34 | assertThat(repository.findAll()).isEmpty(); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /spring-data-opensearch-examples/spring-boot-java-client-gradle/src/test/java/org/opensearch/data/example/repository/TestMarketplaceApplication.java: -------------------------------------------------------------------------------- 1 | package org.opensearch.data.example.repository; 2 | 3 | import org.opensearch.data.example.MarketplaceApplication; 4 | import org.opensearch.testcontainers.OpensearchContainer; 5 | import org.springframework.boot.SpringApplication; 6 | import org.springframework.boot.test.context.TestConfiguration; 7 | import org.springframework.boot.testcontainers.service.connection.ServiceConnection; 8 | import org.springframework.context.annotation.Bean; 9 | 10 | public class TestMarketplaceApplication { 11 | 12 | public static void main(String[] args) { 13 | SpringApplication.from(MarketplaceApplication::main) 14 | .with(ContainerConfig.class) 15 | .run(args); 16 | } 17 | 18 | @TestConfiguration(proxyBeanMethods = false) 19 | static class ContainerConfig { 20 | 21 | @Bean 22 | @ServiceConnection 23 | OpensearchContainer opensearchContainer() { 24 | return new OpensearchContainer<>("opensearchproject/opensearch:2.19.1"); 25 | } 26 | 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /spring-data-opensearch-starter/src/main/java/org/opensearch/spring/boot/autoconfigure/OpenSearchClientAutoConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors. 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | package org.opensearch.spring.boot.autoconfigure; 6 | 7 | import org.opensearch.client.RestClient; 8 | import org.opensearch.client.opensearch.OpenSearchClient; 9 | import org.opensearch.spring.boot.autoconfigure.OpenSearchClientConfigurations.JsonpMapperConfiguration; 10 | import org.opensearch.spring.boot.autoconfigure.OpenSearchClientConfigurations.OpenSearchClientConfiguration; 11 | import org.opensearch.spring.boot.autoconfigure.OpenSearchClientConfigurations.OpenSearchTransportConfiguration; 12 | import org.springframework.boot.autoconfigure.AutoConfiguration; 13 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration; 14 | import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; 15 | import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; 16 | import org.springframework.boot.autoconfigure.jsonb.JsonbAutoConfiguration; 17 | import org.springframework.context.annotation.Import; 18 | 19 | /** 20 | * {@link EnableAutoConfiguration Auto-configuration} for OpenSearch's Java client. 21 | */ 22 | @AutoConfiguration(after = { JsonbAutoConfiguration.class, OpenSearchRestClientAutoConfiguration.class }) 23 | @ConditionalOnBean(RestClient.class) 24 | @ConditionalOnClass(OpenSearchClient.class) 25 | @Import({ JsonpMapperConfiguration.class, OpenSearchTransportConfiguration.class, OpenSearchClientConfiguration.class }) 26 | public class OpenSearchClientAutoConfiguration { 27 | } 28 | -------------------------------------------------------------------------------- /spring-data-opensearch-starter/src/main/java/org/opensearch/spring/boot/autoconfigure/OpenSearchConnectionDetails.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors. 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.spring.boot.autoconfigure; 7 | 8 | import java.util.List; 9 | import org.springframework.boot.autoconfigure.service.connection.ConnectionDetails; 10 | 11 | public interface OpenSearchConnectionDetails extends ConnectionDetails { 12 | 13 | List getUris(); 14 | 15 | String getUsername(); 16 | 17 | String getPassword(); 18 | 19 | default String getPathPrefix() { 20 | return null; 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /spring-data-opensearch-starter/src/main/java/org/opensearch/spring/boot/autoconfigure/OpenSearchRestHighLevelClientAutoConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors. 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.spring.boot.autoconfigure; 7 | 8 | import org.opensearch.client.RestHighLevelClient; 9 | import org.opensearch.spring.boot.autoconfigure.OpenSearchRestHighLevelClientConfigurations.RestHighLevelClientConfiguration; 10 | import org.springframework.boot.autoconfigure.AutoConfiguration; 11 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration; 12 | import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; 13 | import org.springframework.boot.context.properties.EnableConfigurationProperties; 14 | import org.springframework.context.annotation.Import; 15 | 16 | /** 17 | * {@link EnableAutoConfiguration Auto-configuration} for OpenSearch REST High Level client. 18 | */ 19 | @AutoConfiguration(after = OpenSearchRestClientAutoConfiguration.class) 20 | @ConditionalOnClass(RestHighLevelClient.class) 21 | @EnableConfigurationProperties(OpenSearchProperties.class) 22 | @Import({RestHighLevelClientConfiguration.class}) 23 | public class OpenSearchRestHighLevelClientAutoConfiguration {} 24 | -------------------------------------------------------------------------------- /spring-data-opensearch-starter/src/main/java/org/opensearch/spring/boot/autoconfigure/RestClientBuilderCustomizer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors. 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.spring.boot.autoconfigure; 7 | 8 | import org.apache.http.client.config.RequestConfig; 9 | import org.apache.http.client.config.RequestConfig.Builder; 10 | import org.apache.http.impl.nio.client.HttpAsyncClientBuilder; 11 | import org.opensearch.client.RestClientBuilder; 12 | 13 | /** 14 | * Callback interface that can be implemented by beans wishing to further customize the 15 | * {@link org.opensearch.client.RestClient} via a {@link RestClientBuilder} whilst 16 | * retaining default auto-configuration. 17 | * 18 | * Adaptation of the {@link org.springframework.boot.autoconfigure.elasticsearch.RestClientBuilderCustomizer} to 19 | * the needs of OpenSearch. 20 | */ 21 | @FunctionalInterface 22 | public interface RestClientBuilderCustomizer { 23 | /** 24 | * Customize the {@link RestClientBuilder}. 25 | *

26 | * Possibly overrides customizations made with the {@code "opensearch.rest"} 27 | * configuration properties namespace. For more targeted changes, see 28 | * {@link #customize(HttpAsyncClientBuilder)} and 29 | * {@link #customize(RequestConfig.Builder)}. 30 | * @param builder the builder to customize 31 | */ 32 | void customize(RestClientBuilder builder); 33 | 34 | /** 35 | * Customize the {@link HttpAsyncClientBuilder}. 36 | * @param builder the builder 37 | */ 38 | default void customize(HttpAsyncClientBuilder builder) {} 39 | 40 | /** 41 | * Customize the {@link Builder}. 42 | * @param builder the builder 43 | */ 44 | default void customize(Builder builder) {} 45 | } 46 | -------------------------------------------------------------------------------- /spring-data-opensearch-starter/src/main/java/org/opensearch/spring/boot/autoconfigure/data/OpenSearchDataAutoConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors. 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.spring.boot.autoconfigure.data; 7 | 8 | import org.opensearch.data.client.orhlc.OpenSearchRestTemplate; 9 | import org.opensearch.data.client.osc.OpenSearchTemplate; 10 | import org.opensearch.spring.boot.autoconfigure.OpenSearchClientAutoConfiguration; 11 | import org.opensearch.spring.boot.autoconfigure.OpenSearchRestClientAutoConfiguration; 12 | import org.springframework.boot.autoconfigure.AutoConfiguration; 13 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration; 14 | import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; 15 | import org.springframework.context.annotation.Import; 16 | 17 | /** 18 | * {@link EnableAutoConfiguration Auto-configuration} for Spring Data's OpenSearch support. 19 | * 20 | * Adaptation of the {@link org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchDataAutoConfiguration} to 21 | * the needs of OpenSearch. 22 | */ 23 | @AutoConfiguration(after = {OpenSearchClientAutoConfiguration.class, OpenSearchRestClientAutoConfiguration.class}) 24 | @ConditionalOnClass({OpenSearchRestTemplate.class, OpenSearchTemplate.class}) 25 | @Import({OpenSearchDataConfiguration.BaseConfiguration.class, OpenSearchDataConfiguration.JavaClientConfiguration.class}) 26 | public class OpenSearchDataAutoConfiguration {} 27 | -------------------------------------------------------------------------------- /spring-data-opensearch-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports: -------------------------------------------------------------------------------- 1 | org.opensearch.spring.boot.autoconfigure.OpenSearchClientAutoConfiguration 2 | org.opensearch.spring.boot.autoconfigure.OpenSearchRestClientAutoConfiguration 3 | org.opensearch.spring.boot.autoconfigure.OpenSearchRestHighLevelClientAutoConfiguration 4 | org.opensearch.spring.boot.autoconfigure.data.OpenSearchDataAutoConfiguration 5 | -------------------------------------------------------------------------------- /spring-data-opensearch-starter/src/test/java/org/opensearch/spring/boot/autoconfigure/data/entity/Product.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors. 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.spring.boot.autoconfigure.data.entity; 7 | 8 | import org.springframework.data.annotation.Id; 9 | import org.springframework.data.elasticsearch.annotations.Document; 10 | import org.springframework.data.elasticsearch.annotations.Setting; 11 | import org.springframework.lang.Nullable; 12 | 13 | @Document(indexName = "products") 14 | @Setting(shards = 1, replicas = 0, refreshInterval = "-1") 15 | public class Product { 16 | @Nullable 17 | @Id 18 | private String name; 19 | 20 | public Product(@Nullable String name) { 21 | this.name = name; 22 | } 23 | 24 | @Nullable 25 | public String getName() { 26 | return name; 27 | } 28 | 29 | public void setName(@Nullable String name) { 30 | this.name = name; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /spring-data-opensearch-starter/src/test/java/org/opensearch/spring/boot/autoconfigure/data/entity/ProductOpenSearchRepository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors. 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.spring.boot.autoconfigure.data.entity; 7 | 8 | import org.springframework.data.domain.Page; 9 | import org.springframework.data.domain.Pageable; 10 | import org.springframework.data.elasticsearch.repository.ElasticsearchRepository; 11 | 12 | public interface ProductOpenSearchRepository extends ElasticsearchRepository { 13 | Page findAll(Pageable pageable); 14 | 15 | Page findByNameLikeAllIgnoringCase(String name, Pageable pageable); 16 | 17 | Product findByNameAllIgnoringCase(String name, String country); 18 | } 19 | -------------------------------------------------------------------------------- /spring-data-opensearch-starter/src/test/java/org/opensearch/spring/boot/autoconfigure/data/repository/ProductRepository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors. 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.spring.boot.autoconfigure.data.repository; 7 | 8 | import org.opensearch.spring.boot.autoconfigure.data.entity.Product; 9 | import org.springframework.data.domain.Page; 10 | import org.springframework.data.domain.Pageable; 11 | import org.springframework.data.repository.Repository; 12 | 13 | public interface ProductRepository extends Repository { 14 | Page findAll(Pageable pageable); 15 | 16 | Page findByNameLikeAllIgnoringCase(String name, Pageable pageable); 17 | 18 | Product findByNameAllIgnoringCase(String name, String country); 19 | } 20 | -------------------------------------------------------------------------------- /spring-data-opensearch-starter/src/test/resources/testcontainers-opensearch.properties: -------------------------------------------------------------------------------- 1 | # 2 | # properties defining the image, these are not passed to the container on startup 3 | # 4 | sde.testcontainers.image-name=opensearchproject/opensearch 5 | sde.testcontainers.image-version=${project.property('sde.testcontainers.image-version')} 6 | -------------------------------------------------------------------------------- /spring-data-opensearch-test-autoconfigure/src/main/java/org/opensearch/spring/boot/autoconfigure/test/AutoConfigureDataOpenSearch.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors. 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.spring.boot.autoconfigure.test; 7 | 8 | import java.lang.annotation.Documented; 9 | import java.lang.annotation.ElementType; 10 | import java.lang.annotation.Inherited; 11 | import java.lang.annotation.Retention; 12 | import java.lang.annotation.RetentionPolicy; 13 | import java.lang.annotation.Target; 14 | import org.springframework.boot.autoconfigure.ImportAutoConfiguration; 15 | import org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchDataAutoConfiguration; 16 | 17 | /** 18 | * {@link ImportAutoConfiguration Auto-configuration imports} for typical Data OpenSearch tests. 19 | * Most tests should consider using {@link DataOpenSearchTest} rather than using this annotation 20 | * directly. 21 | */ 22 | @Target(ElementType.TYPE) 23 | @Retention(RetentionPolicy.RUNTIME) 24 | @Documented 25 | @Inherited 26 | @ImportAutoConfiguration(exclude = ElasticsearchDataAutoConfiguration.class) 27 | public @interface AutoConfigureDataOpenSearch {} 28 | -------------------------------------------------------------------------------- /spring-data-opensearch-test-autoconfigure/src/main/java/org/opensearch/spring/boot/autoconfigure/test/DataOpenSearchTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors. 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.spring.boot.autoconfigure.test; 7 | 8 | import java.lang.annotation.Documented; 9 | import java.lang.annotation.ElementType; 10 | import java.lang.annotation.Inherited; 11 | import java.lang.annotation.Retention; 12 | import java.lang.annotation.RetentionPolicy; 13 | import java.lang.annotation.Target; 14 | import org.junit.jupiter.api.extension.ExtendWith; 15 | import org.springframework.boot.test.autoconfigure.OverrideAutoConfiguration; 16 | import org.springframework.boot.test.autoconfigure.core.AutoConfigureCache; 17 | import org.springframework.boot.test.autoconfigure.filter.TypeExcludeFilters; 18 | import org.springframework.test.context.BootstrapWith; 19 | import org.springframework.test.context.junit.jupiter.SpringExtension; 20 | 21 | /** 22 | * Annotation that can be used for a Data OpenSearch test that focuses 23 | * only on Spring Data OpenSearch components. 24 | *

25 | * Using this annotation will disable full auto-configuration and instead apply only 26 | * configuration relevant to Data OpenSearch tests. 27 | *

28 | * When using JUnit 4, this annotation should be used in combination with 29 | * {@code @RunWith(SpringRunner.class)}. 30 | */ 31 | @Target(ElementType.TYPE) 32 | @Retention(RetentionPolicy.RUNTIME) 33 | @Documented 34 | @Inherited 35 | @BootstrapWith(DataOpenSearchTestContextBootstrapper.class) 36 | @ExtendWith(SpringExtension.class) 37 | @OverrideAutoConfiguration(enabled = false) 38 | @TypeExcludeFilters(OpenSearchTypeExcludeFilter.class) 39 | @AutoConfigureCache 40 | @AutoConfigureDataOpenSearch 41 | public @interface DataOpenSearchTest {} 42 | -------------------------------------------------------------------------------- /spring-data-opensearch-test-autoconfigure/src/main/java/org/opensearch/spring/boot/autoconfigure/test/DataOpenSearchTestContextBootstrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors. 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.spring.boot.autoconfigure.test; 7 | 8 | import org.springframework.boot.test.context.SpringBootTestContextBootstrapper; 9 | import org.springframework.core.annotation.MergedAnnotations; 10 | import org.springframework.core.annotation.MergedAnnotations.SearchStrategy; 11 | 12 | class DataOpenSearchTestContextBootstrapper extends SpringBootTestContextBootstrapper { 13 | @Override 14 | protected String[] getProperties(Class testClass) { 15 | return MergedAnnotations.from(testClass, SearchStrategy.INHERITED_ANNOTATIONS) 16 | .get(DataOpenSearchTest.class) 17 | .getValue("properties", String[].class) 18 | .orElse(null); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /spring-data-opensearch-test-autoconfigure/src/main/java/org/opensearch/spring/boot/autoconfigure/test/OpenSearchTypeExcludeFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors. 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.spring.boot.autoconfigure.test; 7 | 8 | import org.springframework.boot.context.TypeExcludeFilter; 9 | import org.springframework.boot.test.autoconfigure.filter.StandardAnnotationCustomizableTypeExcludeFilter; 10 | 11 | /** 12 | * {@link TypeExcludeFilter} for {@link DataElasticsearchTest}. 13 | */ 14 | class OpenSearchTypeExcludeFilter extends StandardAnnotationCustomizableTypeExcludeFilter { 15 | OpenSearchTypeExcludeFilter(Class testClass) { 16 | super(testClass); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /spring-data-opensearch-test-autoconfigure/src/main/resources/META-INF/spring/org.opensearch.spring.boot.autoconfigure.test.AutoConfigureDataOpenSearch.imports: -------------------------------------------------------------------------------- 1 | org.opensearch.spring.boot.autoconfigure.OpenSearchClientAutoConfiguration 2 | org.opensearch.spring.boot.autoconfigure.OpenSearchRestClientAutoConfiguration 3 | org.opensearch.spring.boot.autoconfigure.OpenSearchRestHighLevelClientAutoConfiguration 4 | org.opensearch.spring.boot.autoconfigure.data.OpenSearchDataAutoConfiguration 5 | -------------------------------------------------------------------------------- /spring-data-opensearch-testcontainers/src/main/resources/META-INF/spring.factories: -------------------------------------------------------------------------------- 1 | org.springframework.boot.autoconfigure.service.connection.ConnectionDetailsFactory=\ 2 | org.opensearch.spring.boot.testcontainers.service.connection.OpenSearchContainerConnectionDetailsFactory -------------------------------------------------------------------------------- /spring-data-opensearch-testcontainers/src/test/resources/logback-test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | %d{HH:mm:ss.SSS} %-5level %logger - %msg%n 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/main/java/org/opensearch/data/client/orhlc/AbstractOpenSearchConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | * 5 | * The OpenSearch Contributors require contributions made to 6 | * this file be licensed under the Apache-2.0 license or a 7 | * compatible open source license. 8 | */ 9 | 10 | package org.opensearch.data.client.orhlc; 11 | 12 | import org.opensearch.client.RestHighLevelClient; 13 | import org.springframework.context.annotation.Bean; 14 | import org.springframework.data.elasticsearch.config.ElasticsearchConfigurationSupport; 15 | import org.springframework.data.elasticsearch.core.ElasticsearchOperations; 16 | import org.springframework.data.elasticsearch.core.convert.ElasticsearchConverter; 17 | 18 | /** 19 | * @see ElasticsearchConfigurationSupport 20 | * @since 0.1 21 | */ 22 | public abstract class AbstractOpenSearchConfiguration extends ElasticsearchConfigurationSupport { 23 | 24 | /** 25 | * Return the {@link RestHighLevelClient} instance used to connect to the cluster.
26 | * 27 | * @return never {@literal null}. 28 | */ 29 | @Bean 30 | public abstract RestHighLevelClient opensearchClient(); 31 | 32 | /** 33 | * Creates {@link ElasticsearchOperations}. 34 | * 35 | * @return never {@literal null}. 36 | */ 37 | @Bean(name = {"elasticsearchOperations", "elasticsearchTemplate", "opensearchTemplate"}) 38 | public ElasticsearchOperations elasticsearchOperations( 39 | ElasticsearchConverter elasticsearchConverter, RestHighLevelClient opensearchClient) { 40 | 41 | OpenSearchRestTemplate template = new OpenSearchRestTemplate(opensearchClient, elasticsearchConverter); 42 | template.setRefreshPolicy(refreshPolicy()); 43 | 44 | return template; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/main/java/org/opensearch/data/client/orhlc/DefaultClusterOperations.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | * 5 | * The OpenSearch Contributors require contributions made to 6 | * this file be licensed under the Apache-2.0 license or a 7 | * compatible open source license. 8 | */ 9 | 10 | package org.opensearch.data.client.orhlc; 11 | 12 | import org.opensearch.action.admin.cluster.health.ClusterHealthRequest; 13 | import org.opensearch.action.admin.cluster.health.ClusterHealthResponse; 14 | import org.opensearch.client.RequestOptions; 15 | import org.springframework.data.elasticsearch.core.cluster.ClusterHealth; 16 | import org.springframework.data.elasticsearch.core.cluster.ClusterOperations; 17 | 18 | /** 19 | * Default implementation of {@link ClusterOperations} using the {@link OpenSearchRestTemplate}. 20 | * @since 0.1 21 | */ 22 | class DefaultClusterOperations implements ClusterOperations { 23 | 24 | private final OpenSearchRestTemplate template; 25 | 26 | DefaultClusterOperations(OpenSearchRestTemplate template) { 27 | this.template = template; 28 | } 29 | 30 | @Override 31 | public ClusterHealth health() { 32 | 33 | ClusterHealthResponse clusterHealthResponse = 34 | template.execute(client -> client.cluster().health(new ClusterHealthRequest(), RequestOptions.DEFAULT)); 35 | return ResponseConverter.clusterHealth(clusterHealthResponse); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/main/java/org/opensearch/data/client/orhlc/OpenSearchAggregations.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | * 5 | * The OpenSearch Contributors require contributions made to 6 | * this file be licensed under the Apache-2.0 license or a 7 | * compatible open source license. 8 | */ 9 | 10 | package org.opensearch.data.client.orhlc; 11 | 12 | import org.opensearch.search.aggregations.Aggregations; 13 | import org.springframework.data.elasticsearch.core.AggregationsContainer; 14 | import org.springframework.lang.NonNull; 15 | 16 | /** 17 | * AggregationsContainer implementation for the OpenSearch aggregations. 18 | * @since 0.1 19 | */ 20 | public class OpenSearchAggregations implements AggregationsContainer { 21 | 22 | private final Aggregations aggregations; 23 | 24 | public OpenSearchAggregations(Aggregations aggregations) { 25 | this.aggregations = aggregations; 26 | } 27 | 28 | @NonNull 29 | @Override 30 | public Aggregations aggregations() { 31 | return aggregations; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/main/java/org/opensearch/data/client/orhlc/OpenSearchClusterOperations.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | * 5 | * The OpenSearch Contributors require contributions made to 6 | * this file be licensed under the Apache-2.0 license or a 7 | * compatible open source license. 8 | */ 9 | 10 | package org.opensearch.data.client.orhlc; 11 | 12 | import org.springframework.data.elasticsearch.core.cluster.ClusterOperations; 13 | import org.springframework.util.Assert; 14 | 15 | /** 16 | * OpenSearch cluster operations 17 | * @since 0.1 18 | */ 19 | public class OpenSearchClusterOperations { 20 | /** 21 | * Creates a ClusterOperations for a {@link OpenSearchRestTemplate}. 22 | * 23 | * @param template the template, must not be {@literal null} 24 | * @return ClusterOperations 25 | */ 26 | public static ClusterOperations forTemplate(OpenSearchRestTemplate template) { 27 | 28 | Assert.notNull(template, "template must not be null"); 29 | 30 | return new DefaultClusterOperations(template); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/main/java/org/opensearch/data/client/orhlc/ScriptField.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | * 5 | * The OpenSearch Contributors require contributions made to 6 | * this file be licensed under the Apache-2.0 license or a 7 | * compatible open source license. 8 | */ 9 | 10 | package org.opensearch.data.client.orhlc; 11 | 12 | import org.opensearch.script.Script; 13 | 14 | /** 15 | * Scripted field 16 | * 17 | * @since 0.1 18 | */ 19 | public record ScriptField(String fieldName, Script script) { 20 | 21 | } 22 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/main/java/org/opensearch/data/client/orhlc/SearchHitsUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | * 5 | * The OpenSearch Contributors require contributions made to 6 | * this file be licensed under the Apache-2.0 license or a 7 | * compatible open source license. 8 | */ 9 | 10 | package org.opensearch.data.client.orhlc; 11 | 12 | import org.opensearch.search.SearchHits; 13 | 14 | /** 15 | * Utility class to prevent leaking of Lucene API into Spring Data OpenSearch. 16 | * @since 0.1 17 | */ 18 | public final class SearchHitsUtil { 19 | private SearchHitsUtil() {} 20 | 21 | public static long getTotalCount(SearchHits searchHits) { 22 | return searchHits.getTotalHits().value; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/main/java/org/opensearch/data/client/osc/Aggregation.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022-2024 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opensearch.data.client.osc; 17 | 18 | import org.opensearch.client.opensearch._types.aggregations.Aggregate; 19 | 20 | /** 21 | * Class to combine an OpenSearch {@link Aggregate} with its name. Necessary as the OpenSearch Aggregate does not know its name. 22 | * 23 | * @author Peter-Josef Meisch 24 | * @since 4.4 25 | */ 26 | public record Aggregation(String name, Aggregate aggregate) { 27 | 28 | /** 29 | * @deprecated Use {@link #name()} instead 30 | */ 31 | @Deprecated 32 | public String getName() { 33 | return name(); 34 | } 35 | 36 | /** 37 | * @deprecated Use {@link #aggregate()} instead 38 | */ 39 | @Deprecated 40 | public Aggregate getAggregate() { 41 | return aggregate(); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/main/java/org/opensearch/data/client/osc/CriteriaQueryException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021-2024 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opensearch.data.client.osc; 17 | 18 | import org.springframework.dao.UncategorizedDataAccessException; 19 | 20 | /** 21 | * @author Peter-Josef Meisch 22 | * @since 4.4 23 | */ 24 | public class CriteriaQueryException extends UncategorizedDataAccessException { 25 | public CriteriaQueryException(String msg) { 26 | super(msg, null); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/main/java/org/opensearch/data/client/osc/EntityAsMap.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021-2024 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opensearch.data.client.osc; 17 | 18 | import org.springframework.data.elasticsearch.support.DefaultStringObjectMap; 19 | 20 | /** 21 | * A Map<String,Object> to represent any entity as it's returned from OpenSearch and before it is converted to a 22 | * {@link org.springframework.data.elasticsearch.core.document.Document}. 23 | * 24 | * @author Peter-Josef Meisch 25 | * @since 4.4 26 | */ 27 | public class EntityAsMap extends DefaultStringObjectMap {} 28 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/main/java/org/opensearch/data/client/osc/OpenSearchAggregation.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022-2024 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opensearch.data.client.osc; 17 | 18 | import org.springframework.data.elasticsearch.core.AggregationContainer; 19 | 20 | /** 21 | * {@link AggregationContainer} for a {@link Aggregation} that holds OpenSearch data. 22 | * 23 | * @author Peter-Josef Meisch 24 | * @since 4.4 25 | */ 26 | public record OpenSearchAggregation(Aggregation aggregation) implements AggregationContainer { 27 | 28 | } 29 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/main/java/org/opensearch/data/client/osc/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022-2024 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * This package contains classes that use the new OpenSearch client library (org.opensearch.client:opensearch-java) 19 | * to access OpenSearch. 20 | */ 21 | @org.springframework.lang.NonNullApi 22 | @org.springframework.lang.NonNullFields 23 | package org.opensearch.data.client.osc; 24 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/main/java/org/opensearch/data/core/OpenSearchOperations.java: -------------------------------------------------------------------------------- 1 | package org.opensearch.data.core; 2 | 3 | import java.time.Duration; 4 | import java.util.List; 5 | import org.springframework.data.elasticsearch.core.ElasticsearchOperations; 6 | 7 | /** 8 | * The extension over {@link ElasticsearchOperations} with OpenSearch specific operations. 9 | */ 10 | public interface OpenSearchOperations extends ElasticsearchOperations { 11 | /** 12 | * Return all active point in time searches 13 | * @return all active point in time searches 14 | */ 15 | List listPointInTime(); 16 | 17 | /** 18 | * Describes the point in time entry 19 | * 20 | * @param id the point in time id 21 | * @param creationTime the time this point in time was created 22 | * @param keepAlive the new keep alive value for this point in time 23 | */ 24 | record PitInfo(String id, long creationTime, Duration keepAlive) { 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/opensearch/data/client/EnabledIfOpenSearchVersion.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | * 5 | * The OpenSearch Contributors require contributions made to 6 | * this file be licensed under the Apache-2.0 license or a 7 | * compatible open source license. 8 | */ 9 | 10 | package org.opensearch.data.client; 11 | 12 | import java.lang.annotation.ElementType; 13 | import java.lang.annotation.Retention; 14 | import java.lang.annotation.RetentionPolicy; 15 | import java.lang.annotation.Target; 16 | import org.junit.jupiter.api.extension.ExtendWith; 17 | 18 | /** 19 | * Meta-annotation to enable OpenSearch-specific test cases only on or after specific version 20 | */ 21 | @Target({ElementType.TYPE, ElementType.METHOD}) 22 | @Retention(RetentionPolicy.RUNTIME) 23 | @ExtendWith(EnabledIfOpenSearchVersionCondition.class) 24 | public @interface EnabledIfOpenSearchVersion { 25 | /** 26 | * The minimal required version of the OpenSearch this test could run on 27 | */ 28 | String onOrAfter(); 29 | 30 | /** 31 | * The reason (issue reference) why this test is not runnable on previous version 32 | */ 33 | String reason(); 34 | } 35 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/opensearch/data/client/JUnit5SampleOpenSearchRestTemplateTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | * 5 | * The OpenSearch Contributors require contributions made to 6 | * this file be licensed under the Apache-2.0 license or a 7 | * compatible open source license. 8 | */ 9 | 10 | package org.opensearch.data.client; 11 | 12 | import static org.assertj.core.api.Assertions.*; 13 | 14 | import org.junit.jupiter.api.DisplayName; 15 | import org.junit.jupiter.api.Test; 16 | import org.opensearch.data.client.junit.jupiter.OpenSearchRestTemplateConfiguration; 17 | import org.opensearch.data.client.orhlc.OpenSearchRestTemplate; 18 | import org.springframework.beans.factory.annotation.Autowired; 19 | import org.springframework.data.elasticsearch.core.ElasticsearchOperations; 20 | import org.springframework.data.elasticsearch.junit.jupiter.SpringIntegrationTest; 21 | import org.springframework.test.context.ContextConfiguration; 22 | 23 | /** 24 | * class demonstrating the setup of a JUnit 5 test in Spring Data OpenSearch that uses the rest client. The 25 | * ContextConfiguration must include the {@link OpenSearchRestTemplateConfiguration} class. 26 | */ 27 | @SpringIntegrationTest 28 | @ContextConfiguration(classes = {OpenSearchRestTemplateConfiguration.class}) 29 | @DisplayName("a sample JUnit 5 test with rest client") 30 | public class JUnit5SampleOpenSearchRestTemplateTests { 31 | 32 | @Autowired 33 | private ElasticsearchOperations elasticsearchOperations; 34 | 35 | @Test 36 | @DisplayName("should have a OpenSearchRestTemplate") 37 | void shouldHaveARestTemplate() { 38 | assertThat(elasticsearchOperations).isNotNull().isInstanceOf(OpenSearchRestTemplate.class); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/opensearch/data/client/config/AuditingORHLCIntegrationTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | * 5 | * The OpenSearch Contributors require contributions made to 6 | * this file be licensed under the Apache-2.0 license or a 7 | * compatible open source license. 8 | */ 9 | 10 | package org.opensearch.data.client.config; 11 | 12 | import org.opensearch.data.client.junit.jupiter.OpenSearchRestTemplateConfiguration; 13 | import org.springframework.context.annotation.Import; 14 | import org.springframework.data.elasticsearch.config.AuditingIntegrationTests; 15 | import org.springframework.test.context.ContextConfiguration; 16 | 17 | @ContextConfiguration(classes = {AuditingORHLCIntegrationTests.Config.class}) 18 | public class AuditingORHLCIntegrationTests extends AuditingIntegrationTests { 19 | 20 | @Import({OpenSearchRestTemplateConfiguration.class, AuditingIntegrationTests.Config.class}) 21 | static class Config {} 22 | } 23 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/opensearch/data/client/config/AuditingOSCIntegrationTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | * 5 | * The OpenSearch Contributors require contributions made to 6 | * this file be licensed under the Apache-2.0 license or a 7 | * compatible open source license. 8 | */ 9 | 10 | package org.opensearch.data.client.config; 11 | 12 | import org.opensearch.data.client.junit.jupiter.OpenSearchTemplateConfiguration; 13 | import org.springframework.context.annotation.Import; 14 | import org.springframework.data.elasticsearch.config.AuditingIntegrationTests; 15 | import org.springframework.test.context.ContextConfiguration; 16 | 17 | @ContextConfiguration(classes = {AuditingOSCIntegrationTests.Config.class}) 18 | public class AuditingOSCIntegrationTests extends AuditingIntegrationTests { 19 | 20 | @Import({OpenSearchTemplateConfiguration.class, AuditingIntegrationTests.Config.class}) 21 | static class Config {} 22 | } 23 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/opensearch/data/client/config/nested/EnableNestedRepositoriesORHLCIntegrationTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | * 5 | * The OpenSearch Contributors require contributions made to 6 | * this file be licensed under the Apache-2.0 license or a 7 | * compatible open source license. 8 | */ 9 | 10 | package org.opensearch.data.client.config.nested; 11 | 12 | import org.opensearch.data.client.junit.jupiter.OpenSearchRestTemplateConfiguration; 13 | import org.springframework.context.annotation.Bean; 14 | import org.springframework.context.annotation.Configuration; 15 | import org.springframework.context.annotation.Import; 16 | import org.springframework.data.elasticsearch.config.nested.EnableNestedRepositoriesIntegrationTests; 17 | import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories; 18 | import org.springframework.data.elasticsearch.utils.IndexNameProvider; 19 | import org.springframework.test.context.ContextConfiguration; 20 | 21 | @ContextConfiguration(classes = {EnableNestedRepositoriesORHLCIntegrationTests.Config.class}) 22 | public class EnableNestedRepositoriesORHLCIntegrationTests extends EnableNestedRepositoriesIntegrationTests { 23 | 24 | @Configuration 25 | @Import({OpenSearchRestTemplateConfiguration.class}) 26 | @EnableElasticsearchRepositories( 27 | basePackages = { 28 | "org.opensearch.data.client.config.nested", 29 | "org.springframework.data.elasticsearch.config.nested" 30 | }, 31 | considerNestedRepositories = true) 32 | static class Config { 33 | @Bean 34 | IndexNameProvider indexNameProvider() { 35 | return new IndexNameProvider("nested-repositories-os"); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/opensearch/data/client/config/nested/EnableNestedRepositoriesOSCIntegrationTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | * 5 | * The OpenSearch Contributors require contributions made to 6 | * this file be licensed under the Apache-2.0 license or a 7 | * compatible open source license. 8 | */ 9 | 10 | package org.opensearch.data.client.config.nested; 11 | 12 | import org.opensearch.data.client.junit.jupiter.OpenSearchTemplateConfiguration; 13 | import org.springframework.context.annotation.Bean; 14 | import org.springframework.context.annotation.Configuration; 15 | import org.springframework.context.annotation.Import; 16 | import org.springframework.data.elasticsearch.config.nested.EnableNestedRepositoriesIntegrationTests; 17 | import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories; 18 | import org.springframework.data.elasticsearch.utils.IndexNameProvider; 19 | import org.springframework.test.context.ContextConfiguration; 20 | 21 | @ContextConfiguration(classes = {EnableNestedRepositoriesOSCIntegrationTests.Config.class}) 22 | public class EnableNestedRepositoriesOSCIntegrationTests extends EnableNestedRepositoriesIntegrationTests { 23 | 24 | @Configuration 25 | @Import({OpenSearchTemplateConfiguration.class}) 26 | @EnableElasticsearchRepositories( 27 | basePackages = { 28 | "org.opensearch.data.client.config.nested", 29 | "org.springframework.data.elasticsearch.config.nested" 30 | }, 31 | considerNestedRepositories = true) 32 | static class Config { 33 | @Bean 34 | IndexNameProvider indexNameProvider() { 35 | return new IndexNameProvider("nested-repositories-os"); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/opensearch/data/client/config/notnested/EnableRepositoriesORHLCIntegrationTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | * 5 | * The OpenSearch Contributors require contributions made to 6 | * this file be licensed under the Apache-2.0 license or a 7 | * compatible open source license. 8 | */ 9 | 10 | package org.opensearch.data.client.config.notnested; 11 | 12 | import org.opensearch.data.client.junit.jupiter.OpenSearchRestTemplateConfiguration; 13 | import org.springframework.context.annotation.Bean; 14 | import org.springframework.context.annotation.Configuration; 15 | import org.springframework.context.annotation.Import; 16 | import org.springframework.data.elasticsearch.config.notnested.EnableRepositoriesIntegrationTests; 17 | import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories; 18 | import org.springframework.data.elasticsearch.utils.IndexNameProvider; 19 | 20 | public class EnableRepositoriesORHLCIntegrationTests extends EnableRepositoriesIntegrationTests { 21 | 22 | @Configuration 23 | @Import({OpenSearchRestTemplateConfiguration.class}) 24 | @EnableElasticsearchRepositories(basePackages = {"org.springframework.data.elasticsearch.config.notnested"}) 25 | static class Config { 26 | @Bean 27 | IndexNameProvider indexNameProvider() { 28 | return new IndexNameProvider("repositories-os"); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/opensearch/data/client/config/notnested/EnableRepositoriesOSCIntegrationTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | * 5 | * The OpenSearch Contributors require contributions made to 6 | * this file be licensed under the Apache-2.0 license or a 7 | * compatible open source license. 8 | */ 9 | 10 | package org.opensearch.data.client.config.notnested; 11 | 12 | import org.opensearch.data.client.junit.jupiter.OpenSearchTemplateConfiguration; 13 | import org.springframework.context.annotation.Bean; 14 | import org.springframework.context.annotation.Configuration; 15 | import org.springframework.context.annotation.Import; 16 | import org.springframework.data.elasticsearch.config.notnested.EnableRepositoriesIntegrationTests; 17 | import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories; 18 | import org.springframework.data.elasticsearch.utils.IndexNameProvider; 19 | 20 | public class EnableRepositoriesOSCIntegrationTests extends EnableRepositoriesIntegrationTests { 21 | 22 | @Configuration 23 | @Import({OpenSearchTemplateConfiguration.class}) 24 | @EnableElasticsearchRepositories(basePackages = {"org.springframework.data.elasticsearch.config.notnested"}) 25 | static class Config { 26 | @Bean 27 | IndexNameProvider indexNameProvider() { 28 | return new IndexNameProvider("repositories-os"); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/opensearch/data/client/core/ReindexORHLCIntegrationTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | * 5 | * The OpenSearch Contributors require contributions made to 6 | * this file be licensed under the Apache-2.0 license or a 7 | * compatible open source license. 8 | */ 9 | 10 | package org.opensearch.data.client.core; 11 | 12 | import org.opensearch.data.client.junit.jupiter.OpenSearchRestTemplateConfiguration; 13 | import org.opensearch.data.client.orhlc.NativeSearchQueryBuilder; 14 | import org.opensearch.index.query.QueryBuilders; 15 | import org.springframework.context.annotation.Bean; 16 | import org.springframework.context.annotation.Configuration; 17 | import org.springframework.context.annotation.Import; 18 | import org.springframework.data.elasticsearch.core.ReindexIntegrationTests; 19 | import org.springframework.data.elasticsearch.core.query.Query; 20 | import org.springframework.data.elasticsearch.utils.IndexNameProvider; 21 | import org.springframework.test.context.ContextConfiguration; 22 | 23 | @ContextConfiguration(classes = {ReindexORHLCIntegrationTests.Config.class}) 24 | public class ReindexORHLCIntegrationTests extends ReindexIntegrationTests { 25 | 26 | @Configuration 27 | @Import({OpenSearchRestTemplateConfiguration.class}) 28 | static class Config { 29 | @Bean 30 | IndexNameProvider indexNameProvider() { 31 | return new IndexNameProvider("reindex-os"); 32 | } 33 | } 34 | 35 | @Override 36 | protected Query queryForId(String id) { 37 | return new NativeSearchQueryBuilder() 38 | .withQuery(QueryBuilders.termQuery("_id", id)) 39 | .build(); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/opensearch/data/client/core/ReindexOSCIntegrationTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | * 5 | * The OpenSearch Contributors require contributions made to 6 | * this file be licensed under the Apache-2.0 license or a 7 | * compatible open source license. 8 | */ 9 | 10 | package org.opensearch.data.client.core; 11 | 12 | 13 | import static org.opensearch.data.client.osc.Queries.termQueryAsQuery; 14 | 15 | import org.opensearch.data.client.junit.jupiter.OpenSearchTemplateConfiguration; 16 | import org.opensearch.data.client.osc.NativeQuery; 17 | import org.springframework.context.annotation.Bean; 18 | import org.springframework.context.annotation.Configuration; 19 | import org.springframework.context.annotation.Import; 20 | import org.springframework.data.elasticsearch.core.ReindexIntegrationTests; 21 | import org.springframework.data.elasticsearch.core.query.Query; 22 | import org.springframework.data.elasticsearch.utils.IndexNameProvider; 23 | import org.springframework.test.context.ContextConfiguration; 24 | 25 | @ContextConfiguration(classes = {ReindexOSCIntegrationTests.Config.class}) 26 | public class ReindexOSCIntegrationTests extends ReindexIntegrationTests { 27 | 28 | @Configuration 29 | @Import({OpenSearchTemplateConfiguration.class}) 30 | static class Config { 31 | @Bean 32 | IndexNameProvider indexNameProvider() { 33 | return new IndexNameProvider("reindex-os"); 34 | } 35 | } 36 | 37 | @Override 38 | protected Query queryForId(String id) { 39 | return NativeQuery.builder().withQuery(termQueryAsQuery("_id", id)).build(); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/opensearch/data/client/core/SourceFilterORHLCIntegrationTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | * 5 | * The OpenSearch Contributors require contributions made to 6 | * this file be licensed under the Apache-2.0 license or a 7 | * compatible open source license. 8 | */ 9 | 10 | package org.opensearch.data.client.core; 11 | 12 | import org.opensearch.data.client.junit.jupiter.OpenSearchRestTemplateConfiguration; 13 | import org.springframework.context.annotation.Bean; 14 | import org.springframework.context.annotation.Configuration; 15 | import org.springframework.context.annotation.Import; 16 | import org.springframework.data.elasticsearch.core.SourceFilterIntegrationTests; 17 | import org.springframework.data.elasticsearch.utils.IndexNameProvider; 18 | import org.springframework.test.context.ContextConfiguration; 19 | 20 | @ContextConfiguration(classes = {SourceFilterORHLCIntegrationTests.Config.class}) 21 | public class SourceFilterORHLCIntegrationTests extends SourceFilterIntegrationTests { 22 | 23 | @Configuration 24 | @Import({OpenSearchRestTemplateConfiguration.class}) 25 | static class Config { 26 | @Bean 27 | IndexNameProvider indexNameProvider() { 28 | return new IndexNameProvider("source-filter-os"); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/opensearch/data/client/core/SourceFilterOSCIntegrationTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | * 5 | * The OpenSearch Contributors require contributions made to 6 | * this file be licensed under the Apache-2.0 license or a 7 | * compatible open source license. 8 | */ 9 | 10 | package org.opensearch.data.client.core; 11 | 12 | import org.opensearch.data.client.junit.jupiter.OpenSearchTemplateConfiguration; 13 | import org.springframework.context.annotation.Bean; 14 | import org.springframework.context.annotation.Configuration; 15 | import org.springframework.context.annotation.Import; 16 | import org.springframework.data.elasticsearch.core.SourceFilterIntegrationTests; 17 | import org.springframework.data.elasticsearch.utils.IndexNameProvider; 18 | import org.springframework.test.context.ContextConfiguration; 19 | 20 | @ContextConfiguration(classes = {SourceFilterOSCIntegrationTests.Config.class}) 21 | public class SourceFilterOSCIntegrationTests extends SourceFilterIntegrationTests { 22 | 23 | @Configuration 24 | @Import({OpenSearchTemplateConfiguration.class}) 25 | static class Config { 26 | @Bean 27 | IndexNameProvider indexNameProvider() { 28 | return new IndexNameProvider("source-filter-os"); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/opensearch/data/client/core/cluster/ClusterOperationsORHLCIntegrationTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | * 5 | * The OpenSearch Contributors require contributions made to 6 | * this file be licensed under the Apache-2.0 license or a 7 | * compatible open source license. 8 | */ 9 | 10 | package org.opensearch.data.client.core.cluster; 11 | 12 | import org.opensearch.data.client.junit.jupiter.OpenSearchRestTemplateConfiguration; 13 | import org.springframework.data.elasticsearch.core.cluster.ClusterOperationsIntegrationTests; 14 | import org.springframework.test.context.ContextConfiguration; 15 | 16 | @ContextConfiguration(classes = {OpenSearchRestTemplateConfiguration.class}) 17 | public class ClusterOperationsORHLCIntegrationTests extends ClusterOperationsIntegrationTests {} 18 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/opensearch/data/client/core/cluster/ClusterOperationsOSCIntegrationTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | * 5 | * The OpenSearch Contributors require contributions made to 6 | * this file be licensed under the Apache-2.0 license or a 7 | * compatible open source license. 8 | */ 9 | 10 | package org.opensearch.data.client.core.cluster; 11 | 12 | import org.opensearch.data.client.junit.jupiter.OpenSearchTemplateConfiguration; 13 | import org.springframework.data.elasticsearch.core.cluster.ClusterOperationsIntegrationTests; 14 | import org.springframework.test.context.ContextConfiguration; 15 | 16 | @ContextConfiguration(classes = {OpenSearchTemplateConfiguration.class}) 17 | public class ClusterOperationsOSCIntegrationTests extends ClusterOperationsIntegrationTests {} 18 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/opensearch/data/client/core/event/CallbackORHLCIntegrationTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | * 5 | * The OpenSearch Contributors require contributions made to 6 | * this file be licensed under the Apache-2.0 license or a 7 | * compatible open source license. 8 | */ 9 | 10 | package org.opensearch.data.client.core.event; 11 | 12 | import org.opensearch.data.client.junit.jupiter.OpenSearchRestTemplateConfiguration; 13 | import org.springframework.context.annotation.Bean; 14 | import org.springframework.context.annotation.Configuration; 15 | import org.springframework.context.annotation.Import; 16 | import org.springframework.data.elasticsearch.core.event.CallbackIntegrationTests; 17 | import org.springframework.data.elasticsearch.utils.IndexNameProvider; 18 | import org.springframework.test.context.ContextConfiguration; 19 | 20 | @ContextConfiguration(classes = {CallbackORHLCIntegrationTests.Config.class}) 21 | class CallbackORHLCIntegrationTests extends CallbackIntegrationTests { 22 | 23 | @Configuration 24 | @Import({OpenSearchRestTemplateConfiguration.class, CallbackIntegrationTests.Config.class}) 25 | static class Config { 26 | @Bean 27 | IndexNameProvider indexNameProvider() { 28 | return new IndexNameProvider("callback-os"); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/opensearch/data/client/core/event/CallbackOSCIntegrationTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | * 5 | * The OpenSearch Contributors require contributions made to 6 | * this file be licensed under the Apache-2.0 license or a 7 | * compatible open source license. 8 | */ 9 | 10 | package org.opensearch.data.client.core.event; 11 | 12 | import org.opensearch.data.client.junit.jupiter.OpenSearchTemplateConfiguration; 13 | import org.springframework.context.annotation.Bean; 14 | import org.springframework.context.annotation.Configuration; 15 | import org.springframework.context.annotation.Import; 16 | import org.springframework.data.elasticsearch.core.event.CallbackIntegrationTests; 17 | import org.springframework.data.elasticsearch.utils.IndexNameProvider; 18 | import org.springframework.test.context.ContextConfiguration; 19 | 20 | @ContextConfiguration(classes = {CallbackOSCIntegrationTests.Config.class}) 21 | class CallbackOSCIntegrationTests extends CallbackIntegrationTests { 22 | 23 | @Configuration 24 | @Import({OpenSearchTemplateConfiguration.class, CallbackIntegrationTests.Config.class}) 25 | static class Config { 26 | @Bean 27 | IndexNameProvider indexNameProvider() { 28 | return new IndexNameProvider("callback-os"); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/opensearch/data/client/core/geo/GeoJsonORHLCIntegrationTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | * 5 | * The OpenSearch Contributors require contributions made to 6 | * this file be licensed under the Apache-2.0 license or a 7 | * compatible open source license. 8 | */ 9 | 10 | package org.opensearch.data.client.core.geo; 11 | 12 | import org.junit.jupiter.api.DisplayName; 13 | import org.opensearch.data.client.junit.jupiter.OpenSearchRestTemplateConfiguration; 14 | import org.springframework.context.annotation.Bean; 15 | import org.springframework.context.annotation.Configuration; 16 | import org.springframework.context.annotation.Import; 17 | import org.springframework.data.elasticsearch.core.geo.GeoJsonIntegrationTests; 18 | import org.springframework.data.elasticsearch.utils.IndexNameProvider; 19 | import org.springframework.test.context.ContextConfiguration; 20 | 21 | @ContextConfiguration(classes = {GeoJsonORHLCIntegrationTests.Config.class}) 22 | @DisplayName("GeoJson integration test with RestHighLevelClient") 23 | public class GeoJsonORHLCIntegrationTests extends GeoJsonIntegrationTests { 24 | @Configuration 25 | @Import({OpenSearchRestTemplateConfiguration.class}) 26 | static class Config { 27 | @Bean 28 | IndexNameProvider indexNameProvider() { 29 | return new IndexNameProvider("geojson-integration-os"); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/opensearch/data/client/core/geo/GeoJsonOSCIntegrationTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | * 5 | * The OpenSearch Contributors require contributions made to 6 | * this file be licensed under the Apache-2.0 license or a 7 | * compatible open source license. 8 | */ 9 | 10 | package org.opensearch.data.client.core.geo; 11 | 12 | import org.junit.jupiter.api.DisplayName; 13 | import org.opensearch.data.client.junit.jupiter.OpenSearchTemplateConfiguration; 14 | import org.springframework.context.annotation.Bean; 15 | import org.springframework.context.annotation.Configuration; 16 | import org.springframework.context.annotation.Import; 17 | import org.springframework.data.elasticsearch.core.geo.GeoJsonIntegrationTests; 18 | import org.springframework.data.elasticsearch.utils.IndexNameProvider; 19 | import org.springframework.test.context.ContextConfiguration; 20 | 21 | @ContextConfiguration(classes = {GeoJsonOSCIntegrationTests.Config.class}) 22 | @DisplayName("GeoJson integration test with OpenSearchClient") 23 | public class GeoJsonOSCIntegrationTests extends GeoJsonIntegrationTests { 24 | @Configuration 25 | @Import({OpenSearchTemplateConfiguration.class}) 26 | static class Config { 27 | @Bean 28 | IndexNameProvider indexNameProvider() { 29 | return new IndexNameProvider("geojson-integration-os"); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/opensearch/data/client/core/index/IndexTemplateORHLCIntegrationTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | * 5 | * The OpenSearch Contributors require contributions made to 6 | * this file be licensed under the Apache-2.0 license or a 7 | * compatible open source license. 8 | */ 9 | 10 | package org.opensearch.data.client.core.index; 11 | 12 | import org.opensearch.data.client.junit.jupiter.OpenSearchRestTemplateConfiguration; 13 | import org.springframework.data.elasticsearch.core.index.IndexTemplateIntegrationTests; 14 | import org.springframework.test.context.ContextConfiguration; 15 | 16 | @ContextConfiguration(classes = {OpenSearchRestTemplateConfiguration.class}) 17 | public class IndexTemplateORHLCIntegrationTests extends IndexTemplateIntegrationTests {} 18 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/opensearch/data/client/core/index/IndexTemplateOSCIntegrationTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | * 5 | * The OpenSearch Contributors require contributions made to 6 | * this file be licensed under the Apache-2.0 license or a 7 | * compatible open source license. 8 | */ 9 | 10 | package org.opensearch.data.client.core.index; 11 | 12 | import org.opensearch.data.client.junit.jupiter.OpenSearchTemplateConfiguration; 13 | import org.springframework.data.elasticsearch.core.index.IndexTemplateIntegrationTests; 14 | import org.springframework.test.context.ContextConfiguration; 15 | 16 | @ContextConfiguration(classes = {OpenSearchTemplateConfiguration.class}) 17 | public class IndexTemplateOSCIntegrationTests extends IndexTemplateIntegrationTests {} 18 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/opensearch/data/client/core/indices/IndexOperationsORHLCIntegrationTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | * 5 | * The OpenSearch Contributors require contributions made to 6 | * this file be licensed under the Apache-2.0 license or a 7 | * compatible open source license. 8 | */ 9 | 10 | package org.opensearch.data.client.core.indices; 11 | 12 | import org.opensearch.data.client.junit.jupiter.OpenSearchRestTemplateConfiguration; 13 | import org.springframework.context.annotation.Bean; 14 | import org.springframework.context.annotation.Configuration; 15 | import org.springframework.context.annotation.Import; 16 | import org.springframework.data.elasticsearch.core.indices.IndexOperationsIntegrationTests; 17 | import org.springframework.data.elasticsearch.utils.IndexNameProvider; 18 | import org.springframework.test.context.ContextConfiguration; 19 | 20 | @ContextConfiguration(classes = {IndexOperationsORHLCIntegrationTests.Config.class}) 21 | public class IndexOperationsORHLCIntegrationTests extends IndexOperationsIntegrationTests { 22 | 23 | @Configuration 24 | @Import({OpenSearchRestTemplateConfiguration.class}) 25 | static class Config { 26 | @Bean 27 | IndexNameProvider indexNameProvider() { 28 | return new IndexNameProvider("indexoperations-es7"); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/opensearch/data/client/core/indices/IndexOperationsOSCIntegrationTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | * 5 | * The OpenSearch Contributors require contributions made to 6 | * this file be licensed under the Apache-2.0 license or a 7 | * compatible open source license. 8 | */ 9 | 10 | package org.opensearch.data.client.core.indices; 11 | 12 | import org.opensearch.data.client.junit.jupiter.OpenSearchTemplateConfiguration; 13 | import org.springframework.context.annotation.Bean; 14 | import org.springframework.context.annotation.Configuration; 15 | import org.springframework.context.annotation.Import; 16 | import org.springframework.data.elasticsearch.core.indices.IndexOperationsIntegrationTests; 17 | import org.springframework.data.elasticsearch.utils.IndexNameProvider; 18 | import org.springframework.test.context.ContextConfiguration; 19 | 20 | @ContextConfiguration(classes = {IndexOperationsOSCIntegrationTests.Config.class}) 21 | public class IndexOperationsOSCIntegrationTests extends IndexOperationsIntegrationTests { 22 | 23 | @Configuration 24 | @Import({OpenSearchTemplateConfiguration.class}) 25 | static class Config { 26 | @Bean 27 | IndexNameProvider indexNameProvider() { 28 | return new IndexNameProvider("indexoperations-es7"); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/opensearch/data/client/core/paginating/SearchAfterORHLCIntegrationTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | * 5 | * The OpenSearch Contributors require contributions made to 6 | * this file be licensed under the Apache-2.0 license or a 7 | * compatible open source license. 8 | */ 9 | 10 | package org.opensearch.data.client.core.paginating; 11 | 12 | import org.opensearch.data.client.junit.jupiter.OpenSearchRestTemplateConfiguration; 13 | import org.springframework.context.annotation.Bean; 14 | import org.springframework.context.annotation.Configuration; 15 | import org.springframework.context.annotation.Import; 16 | import org.springframework.data.elasticsearch.core.paginating.SearchAfterIntegrationTests; 17 | import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories; 18 | import org.springframework.data.elasticsearch.utils.IndexNameProvider; 19 | import org.springframework.test.context.ContextConfiguration; 20 | 21 | @ContextConfiguration(classes = {SearchAfterORHLCIntegrationTests.Config.class}) 22 | public class SearchAfterORHLCIntegrationTests extends SearchAfterIntegrationTests { 23 | 24 | @Configuration 25 | @Import({OpenSearchRestTemplateConfiguration.class}) 26 | @EnableElasticsearchRepositories(considerNestedRepositories = true) 27 | static class Config { 28 | @Bean 29 | IndexNameProvider indexNameProvider() { 30 | return new IndexNameProvider("search-after-os"); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/opensearch/data/client/core/paginating/SearchAfterOSCIntegrationTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | * 5 | * The OpenSearch Contributors require contributions made to 6 | * this file be licensed under the Apache-2.0 license or a 7 | * compatible open source license. 8 | */ 9 | 10 | package org.opensearch.data.client.core.paginating; 11 | 12 | import org.opensearch.data.client.junit.jupiter.OpenSearchTemplateConfiguration; 13 | import org.springframework.context.annotation.Bean; 14 | import org.springframework.context.annotation.Configuration; 15 | import org.springframework.context.annotation.Import; 16 | import org.springframework.data.elasticsearch.core.paginating.SearchAfterIntegrationTests; 17 | import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories; 18 | import org.springframework.data.elasticsearch.utils.IndexNameProvider; 19 | import org.springframework.test.context.ContextConfiguration; 20 | 21 | @ContextConfiguration(classes = {SearchAfterOSCIntegrationTests.Config.class}) 22 | public class SearchAfterOSCIntegrationTests extends SearchAfterIntegrationTests { 23 | 24 | @Configuration 25 | @Import({OpenSearchTemplateConfiguration.class}) 26 | @EnableElasticsearchRepositories(considerNestedRepositories = true) 27 | static class Config { 28 | @Bean 29 | IndexNameProvider indexNameProvider() { 30 | return new IndexNameProvider("search-after-os"); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/opensearch/data/client/core/query/CriteriaQueryORHLCIntegrationTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | * 5 | * The OpenSearch Contributors require contributions made to 6 | * this file be licensed under the Apache-2.0 license or a 7 | * compatible open source license. 8 | */ 9 | 10 | package org.opensearch.data.client.core.query; 11 | 12 | import org.opensearch.data.client.junit.jupiter.OpenSearchRestTemplateConfiguration; 13 | import org.springframework.context.annotation.Bean; 14 | import org.springframework.context.annotation.Configuration; 15 | import org.springframework.context.annotation.Import; 16 | import org.springframework.data.elasticsearch.core.query.CriteriaQueryIntegrationTests; 17 | import org.springframework.data.elasticsearch.utils.IndexNameProvider; 18 | import org.springframework.test.context.ContextConfiguration; 19 | 20 | @ContextConfiguration(classes = {CriteriaQueryORHLCIntegrationTests.Config.class}) 21 | public class CriteriaQueryORHLCIntegrationTests extends CriteriaQueryIntegrationTests { 22 | 23 | @Configuration 24 | @Import({OpenSearchRestTemplateConfiguration.class}) 25 | static class Config { 26 | @Bean 27 | IndexNameProvider indexNameProvider() { 28 | return new IndexNameProvider("criteria-query-os"); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/opensearch/data/client/core/query/CriteriaQueryOSCIntegrationTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | * 5 | * The OpenSearch Contributors require contributions made to 6 | * this file be licensed under the Apache-2.0 license or a 7 | * compatible open source license. 8 | */ 9 | 10 | package org.opensearch.data.client.core.query; 11 | 12 | import org.opensearch.data.client.junit.jupiter.OpenSearchTemplateConfiguration; 13 | import org.springframework.context.annotation.Bean; 14 | import org.springframework.context.annotation.Configuration; 15 | import org.springframework.context.annotation.Import; 16 | import org.springframework.data.elasticsearch.core.query.CriteriaQueryIntegrationTests; 17 | import org.springframework.data.elasticsearch.utils.IndexNameProvider; 18 | import org.springframework.test.context.ContextConfiguration; 19 | 20 | @ContextConfiguration(classes = {CriteriaQueryOSCIntegrationTests.Config.class}) 21 | public class CriteriaQueryOSCIntegrationTests extends CriteriaQueryIntegrationTests { 22 | 23 | @Configuration 24 | @Import({OpenSearchTemplateConfiguration.class}) 25 | static class Config { 26 | @Bean 27 | IndexNameProvider indexNameProvider() { 28 | return new IndexNameProvider("criteria-query-os"); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/opensearch/data/client/core/query/NativeQueryOSCIntegrationTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023-2024 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.opensearch.data.client.core.query; 17 | 18 | import org.opensearch.data.client.junit.jupiter.OpenSearchTemplateConfiguration; 19 | import org.springframework.context.annotation.Bean; 20 | import org.springframework.context.annotation.Configuration; 21 | import org.springframework.context.annotation.Import; 22 | import org.springframework.data.elasticsearch.core.query.NativeQueryIntegrationTests; 23 | import org.springframework.data.elasticsearch.utils.IndexNameProvider; 24 | import org.springframework.test.context.ContextConfiguration; 25 | 26 | /** 27 | * @author Peter-Josef Meisch 28 | */ 29 | @ContextConfiguration(classes = { NativeQueryOSCIntegrationTests.Config.class }) 30 | public class NativeQueryOSCIntegrationTests extends NativeQueryIntegrationTests { 31 | @Configuration 32 | @Import({ OpenSearchTemplateConfiguration.class }) 33 | static class Config { 34 | @Bean 35 | IndexNameProvider indexNameProvider() { 36 | return new IndexNameProvider("criteria-os"); 37 | } 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/opensearch/data/client/core/query/SeqNoPrimaryTermTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | * 5 | * The OpenSearch Contributors require contributions made to 6 | * this file be licensed under the Apache-2.0 license or a 7 | * compatible open source license. 8 | */ 9 | 10 | package org.opensearch.data.client.core.query; 11 | 12 | import static org.assertj.core.api.Assertions.*; 13 | 14 | import org.junit.jupiter.api.Test; 15 | import org.opensearch.index.seqno.SequenceNumbers; 16 | import org.springframework.data.elasticsearch.core.query.SeqNoPrimaryTerm; 17 | 18 | class SeqNoPrimaryTermTests { 19 | @Test 20 | void shouldConstructInstanceWithAssignedSeqNoAndPrimaryTerm() { 21 | SeqNoPrimaryTerm instance = new SeqNoPrimaryTerm(1, 2); 22 | 23 | assertThat(instance.sequenceNumber()).isEqualTo(1); 24 | assertThat(instance.primaryTerm()).isEqualTo(2); 25 | } 26 | 27 | @Test 28 | void shouldThrowAnExceptionWhenTryingToConstructWithUnassignedSeqNo() { 29 | assertThatThrownBy(() -> new SeqNoPrimaryTerm(SequenceNumbers.UNASSIGNED_SEQ_NO, 2)) 30 | .isInstanceOf(IllegalArgumentException.class); 31 | } 32 | 33 | @Test 34 | void shouldThrowAnExceptionWhenTryingToConstructWithSeqNoForNoOpsPerformed() { 35 | assertThatThrownBy(() -> new SeqNoPrimaryTerm(SequenceNumbers.NO_OPS_PERFORMED, 2)) 36 | .isInstanceOf(IllegalArgumentException.class); 37 | } 38 | 39 | @Test 40 | void shouldThrowAnExceptionWhenTryingToConstructWithUnassignedPrimaryTerm() { 41 | assertThatThrownBy(() -> new SeqNoPrimaryTerm(1, SequenceNumbers.UNASSIGNED_PRIMARY_TERM)) 42 | .isInstanceOf(IllegalArgumentException.class); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/opensearch/data/client/core/routing/RoutingORHLCIntegrationTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | * 5 | * The OpenSearch Contributors require contributions made to 6 | * this file be licensed under the Apache-2.0 license or a 7 | * compatible open source license. 8 | */ 9 | 10 | package org.opensearch.data.client.core.routing; 11 | 12 | import org.opensearch.data.client.junit.jupiter.OpenSearchRestTemplateConfiguration; 13 | import org.springframework.context.annotation.Bean; 14 | import org.springframework.context.annotation.Configuration; 15 | import org.springframework.context.annotation.Import; 16 | import org.springframework.data.elasticsearch.core.routing.RoutingIntegrationTests; 17 | import org.springframework.data.elasticsearch.utils.IndexNameProvider; 18 | import org.springframework.test.context.ContextConfiguration; 19 | 20 | @ContextConfiguration(classes = {RoutingORHLCIntegrationTests.Config.class}) 21 | public class RoutingORHLCIntegrationTests extends RoutingIntegrationTests { 22 | 23 | @Configuration 24 | @Import({OpenSearchRestTemplateConfiguration.class}) 25 | static class Config { 26 | @Bean 27 | IndexNameProvider indexNameProvider() { 28 | return new IndexNameProvider("routing-os"); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/opensearch/data/client/core/routing/RoutingOSCIntegrationTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | * 5 | * The OpenSearch Contributors require contributions made to 6 | * this file be licensed under the Apache-2.0 license or a 7 | * compatible open source license. 8 | */ 9 | 10 | package org.opensearch.data.client.core.routing; 11 | 12 | import org.opensearch.data.client.junit.jupiter.OpenSearchTemplateConfiguration; 13 | import org.springframework.context.annotation.Bean; 14 | import org.springframework.context.annotation.Configuration; 15 | import org.springframework.context.annotation.Import; 16 | import org.springframework.data.elasticsearch.core.routing.RoutingIntegrationTests; 17 | import org.springframework.data.elasticsearch.utils.IndexNameProvider; 18 | import org.springframework.test.context.ContextConfiguration; 19 | 20 | @ContextConfiguration(classes = {RoutingOSCIntegrationTests.Config.class}) 21 | public class RoutingOSCIntegrationTests extends RoutingIntegrationTests { 22 | 23 | @Configuration 24 | @Import({OpenSearchTemplateConfiguration.class}) 25 | static class Config { 26 | @Bean 27 | IndexNameProvider indexNameProvider() { 28 | return new IndexNameProvider("routing-os"); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/opensearch/data/client/immutable/ImmutableRepositoryORHLCIntegrationTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | * 5 | * The OpenSearch Contributors require contributions made to 6 | * this file be licensed under the Apache-2.0 license or a 7 | * compatible open source license. 8 | */ 9 | 10 | package org.opensearch.data.client.immutable; 11 | 12 | import org.opensearch.data.client.junit.jupiter.OpenSearchRestTemplateConfiguration; 13 | import org.springframework.context.annotation.Bean; 14 | import org.springframework.context.annotation.Configuration; 15 | import org.springframework.context.annotation.Import; 16 | import org.springframework.data.elasticsearch.immutable.ImmutableRepositoryIntegrationTests; 17 | import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories; 18 | import org.springframework.data.elasticsearch.utils.IndexNameProvider; 19 | import org.springframework.test.context.ContextConfiguration; 20 | 21 | @ContextConfiguration(classes = ImmutableRepositoryORHLCIntegrationTests.Config.class) 22 | public class ImmutableRepositoryORHLCIntegrationTests extends ImmutableRepositoryIntegrationTests { 23 | 24 | @Configuration 25 | @Import({OpenSearchRestTemplateConfiguration.class}) 26 | @EnableElasticsearchRepositories( 27 | basePackages = {"org.springframework.data.elasticsearch.immutable"}, 28 | considerNestedRepositories = true) 29 | static class Config { 30 | @Bean 31 | IndexNameProvider indexNameProvider() { 32 | return new IndexNameProvider("immutable-os"); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/opensearch/data/client/immutable/ImmutableRepositoryOSCIntegrationTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | * 5 | * The OpenSearch Contributors require contributions made to 6 | * this file be licensed under the Apache-2.0 license or a 7 | * compatible open source license. 8 | */ 9 | 10 | package org.opensearch.data.client.immutable; 11 | 12 | import org.opensearch.data.client.junit.jupiter.OpenSearchTemplateConfiguration; 13 | import org.springframework.context.annotation.Bean; 14 | import org.springframework.context.annotation.Configuration; 15 | import org.springframework.context.annotation.Import; 16 | import org.springframework.data.elasticsearch.immutable.ImmutableRepositoryIntegrationTests; 17 | import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories; 18 | import org.springframework.data.elasticsearch.utils.IndexNameProvider; 19 | import org.springframework.test.context.ContextConfiguration; 20 | 21 | @ContextConfiguration(classes = ImmutableRepositoryOSCIntegrationTests.Config.class) 22 | public class ImmutableRepositoryOSCIntegrationTests extends ImmutableRepositoryIntegrationTests { 23 | 24 | @Configuration 25 | @Import({OpenSearchTemplateConfiguration.class}) 26 | @EnableElasticsearchRepositories( 27 | basePackages = {"org.springframework.data.elasticsearch.immutable"}, 28 | considerNestedRepositories = true) 29 | static class Config { 30 | @Bean 31 | IndexNameProvider indexNameProvider() { 32 | return new IndexNameProvider("immutable-os"); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/opensearch/data/client/orhlc/OpenSearchORHLCSpecificIntegrationTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | * 5 | * The OpenSearch Contributors require contributions made to 6 | * this file be licensed under the Apache-2.0 license or a 7 | * compatible open source license. 8 | */ 9 | 10 | package org.opensearch.data.client.orhlc; 11 | 12 | import static org.opensearch.index.query.QueryBuilders.matchAllQuery; 13 | 14 | import org.junit.jupiter.api.DisplayName; 15 | import org.opensearch.data.client.junit.jupiter.OpenSearchRestTemplateConfiguration; 16 | import org.opensearch.data.core.OpenSearchSpecificIntegrationTests; 17 | import org.springframework.context.annotation.Bean; 18 | import org.springframework.context.annotation.Configuration; 19 | import org.springframework.context.annotation.Import; 20 | import org.springframework.data.elasticsearch.core.query.BaseQueryBuilder; 21 | import org.springframework.data.elasticsearch.utils.IndexNameProvider; 22 | import org.springframework.test.context.ContextConfiguration; 23 | 24 | @ContextConfiguration(classes = {OpenSearchORHLCSpecificIntegrationTests.Config.class}) 25 | @DisplayName("Using OpenSearch RestHighLevelClient") 26 | public class OpenSearchORHLCSpecificIntegrationTests extends OpenSearchSpecificIntegrationTests { 27 | 28 | @Configuration 29 | @Import({OpenSearchRestTemplateConfiguration.class}) 30 | static class Config { 31 | @Bean 32 | IndexNameProvider indexNameProvider() { 33 | return new IndexNameProvider("integration-specific-os"); 34 | } 35 | } 36 | @Override 37 | protected BaseQueryBuilder getBuilderWithMatchAllQuery() { 38 | return new NativeSearchQueryBuilder().withQuery(matchAllQuery()); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/opensearch/data/client/repositories/custommethod/CustomMethodRepositoryORHLCIntegrationTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | * 5 | * The OpenSearch Contributors require contributions made to 6 | * this file be licensed under the Apache-2.0 license or a 7 | * compatible open source license. 8 | */ 9 | 10 | package org.opensearch.data.client.repositories.custommethod; 11 | 12 | import org.opensearch.data.client.junit.jupiter.OpenSearchRestTemplateConfiguration; 13 | import org.springframework.context.annotation.Bean; 14 | import org.springframework.context.annotation.Configuration; 15 | import org.springframework.context.annotation.Import; 16 | import org.springframework.data.elasticsearch.repositories.custommethod.CustomMethodRepositoryIntegrationTests; 17 | import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories; 18 | import org.springframework.data.elasticsearch.utils.IndexNameProvider; 19 | import org.springframework.test.context.ContextConfiguration; 20 | 21 | @ContextConfiguration(classes = {CustomMethodRepositoryORHLCIntegrationTests.Config.class}) 22 | public class CustomMethodRepositoryORHLCIntegrationTests extends CustomMethodRepositoryIntegrationTests { 23 | 24 | @Configuration 25 | @Import({OpenSearchRestTemplateConfiguration.class}) 26 | @EnableElasticsearchRepositories( 27 | basePackages = {"org.springframework.data.elasticsearch.repositories.custommethod"}, 28 | considerNestedRepositories = true) 29 | static class Config { 30 | @Bean 31 | IndexNameProvider indexNameProvider() { 32 | return new IndexNameProvider("custom-method-repository-os"); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/opensearch/data/client/repositories/custommethod/CustomMethodRepositoryOSCIntegrationTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | * 5 | * The OpenSearch Contributors require contributions made to 6 | * this file be licensed under the Apache-2.0 license or a 7 | * compatible open source license. 8 | */ 9 | 10 | package org.opensearch.data.client.repositories.custommethod; 11 | 12 | import org.opensearch.data.client.junit.jupiter.OpenSearchTemplateConfiguration; 13 | import org.springframework.context.annotation.Bean; 14 | import org.springframework.context.annotation.Configuration; 15 | import org.springframework.context.annotation.Import; 16 | import org.springframework.data.elasticsearch.repositories.custommethod.CustomMethodRepositoryIntegrationTests; 17 | import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories; 18 | import org.springframework.data.elasticsearch.utils.IndexNameProvider; 19 | import org.springframework.test.context.ContextConfiguration; 20 | 21 | @ContextConfiguration(classes = {CustomMethodRepositoryOSCIntegrationTests.Config.class}) 22 | public class CustomMethodRepositoryOSCIntegrationTests extends CustomMethodRepositoryIntegrationTests { 23 | 24 | @Configuration 25 | @Import({OpenSearchTemplateConfiguration.class}) 26 | @EnableElasticsearchRepositories( 27 | basePackages = {"org.springframework.data.elasticsearch.repositories.custommethod"}, 28 | considerNestedRepositories = true) 29 | static class Config { 30 | @Bean 31 | IndexNameProvider indexNameProvider() { 32 | return new IndexNameProvider("custom-method-repository-os"); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/opensearch/data/client/repositories/doubleid/DoubleIDRepositoryORHLCIntegrationTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | * 5 | * The OpenSearch Contributors require contributions made to 6 | * this file be licensed under the Apache-2.0 license or a 7 | * compatible open source license. 8 | */ 9 | 10 | package org.opensearch.data.client.repositories.doubleid; 11 | 12 | import org.opensearch.data.client.junit.jupiter.OpenSearchRestTemplateConfiguration; 13 | import org.springframework.context.annotation.Bean; 14 | import org.springframework.context.annotation.Configuration; 15 | import org.springframework.context.annotation.Import; 16 | import org.springframework.data.elasticsearch.repositories.doubleid.DoubleIDRepositoryIntegrationTests; 17 | import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories; 18 | import org.springframework.data.elasticsearch.utils.IndexNameProvider; 19 | import org.springframework.test.context.ContextConfiguration; 20 | 21 | @ContextConfiguration(classes = {DoubleIDRepositoryORHLCIntegrationTests.Config.class}) 22 | public class DoubleIDRepositoryORHLCIntegrationTests extends DoubleIDRepositoryIntegrationTests { 23 | 24 | @Configuration 25 | @Import({OpenSearchRestTemplateConfiguration.class}) 26 | @EnableElasticsearchRepositories( 27 | basePackages = {"org.springframework.data.elasticsearch.repositories.doubleid"}, 28 | considerNestedRepositories = true) 29 | static class Config { 30 | @Bean 31 | IndexNameProvider indexNameProvider() { 32 | return new IndexNameProvider("doubleid-repository-es7"); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/opensearch/data/client/repositories/doubleid/DoubleIDRepositoryOSCIntegrationTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | * 5 | * The OpenSearch Contributors require contributions made to 6 | * this file be licensed under the Apache-2.0 license or a 7 | * compatible open source license. 8 | */ 9 | 10 | package org.opensearch.data.client.repositories.doubleid; 11 | 12 | import org.opensearch.data.client.junit.jupiter.OpenSearchTemplateConfiguration; 13 | import org.springframework.context.annotation.Bean; 14 | import org.springframework.context.annotation.Configuration; 15 | import org.springframework.context.annotation.Import; 16 | import org.springframework.data.elasticsearch.repositories.doubleid.DoubleIDRepositoryIntegrationTests; 17 | import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories; 18 | import org.springframework.data.elasticsearch.utils.IndexNameProvider; 19 | import org.springframework.test.context.ContextConfiguration; 20 | 21 | @ContextConfiguration(classes = {DoubleIDRepositoryOSCIntegrationTests.Config.class}) 22 | public class DoubleIDRepositoryOSCIntegrationTests extends DoubleIDRepositoryIntegrationTests { 23 | 24 | @Configuration 25 | @Import({OpenSearchTemplateConfiguration.class}) 26 | @EnableElasticsearchRepositories( 27 | basePackages = {"org.springframework.data.elasticsearch.repositories.doubleid"}, 28 | considerNestedRepositories = true) 29 | static class Config { 30 | @Bean 31 | IndexNameProvider indexNameProvider() { 32 | return new IndexNameProvider("doubleid-repository-es7"); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/opensearch/data/client/repositories/dynamicindex/DynamicIndexEntityORHLCIntegrationTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | * 5 | * The OpenSearch Contributors require contributions made to 6 | * this file be licensed under the Apache-2.0 license or a 7 | * compatible open source license. 8 | */ 9 | 10 | package org.opensearch.data.client.repositories.dynamicindex; 11 | 12 | import org.opensearch.data.client.junit.jupiter.OpenSearchRestTemplateConfiguration; 13 | import org.springframework.context.annotation.Bean; 14 | import org.springframework.context.annotation.Configuration; 15 | import org.springframework.context.annotation.Import; 16 | import org.springframework.data.elasticsearch.repositories.dynamicindex.DynamicIndexEntityIntegrationTests; 17 | import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories; 18 | import org.springframework.test.context.ContextConfiguration; 19 | 20 | @ContextConfiguration(classes = {DynamicIndexEntityORHLCIntegrationTests.Config.class}) 21 | public class DynamicIndexEntityORHLCIntegrationTests extends DynamicIndexEntityIntegrationTests { 22 | @Configuration 23 | @Import({OpenSearchRestTemplateConfiguration.class}) 24 | @EnableElasticsearchRepositories( 25 | basePackages = {"org.springframework.data.elasticsearch.repositories.dynamicindex"}, 26 | considerNestedRepositories = true) 27 | static class Config { 28 | @Bean 29 | public IndexNameProvider indexNameProvider() { 30 | return new IndexNameProvider(); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/opensearch/data/client/repositories/dynamicindex/DynamicIndexEntityOSCIntegrationTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | * 5 | * The OpenSearch Contributors require contributions made to 6 | * this file be licensed under the Apache-2.0 license or a 7 | * compatible open source license. 8 | */ 9 | 10 | package org.opensearch.data.client.repositories.dynamicindex; 11 | 12 | import org.opensearch.data.client.junit.jupiter.OpenSearchTemplateConfiguration; 13 | import org.springframework.context.annotation.Bean; 14 | import org.springframework.context.annotation.Configuration; 15 | import org.springframework.context.annotation.Import; 16 | import org.springframework.data.elasticsearch.repositories.dynamicindex.DynamicIndexEntityIntegrationTests; 17 | import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories; 18 | import org.springframework.test.context.ContextConfiguration; 19 | 20 | @ContextConfiguration(classes = {DynamicIndexEntityOSCIntegrationTests.Config.class}) 21 | public class DynamicIndexEntityOSCIntegrationTests extends DynamicIndexEntityIntegrationTests { 22 | @Configuration 23 | @Import({OpenSearchTemplateConfiguration.class}) 24 | @EnableElasticsearchRepositories( 25 | basePackages = {"org.springframework.data.elasticsearch.repositories.dynamicindex"}, 26 | considerNestedRepositories = true) 27 | static class Config { 28 | @Bean 29 | public IndexNameProvider indexNameProvider() { 30 | return new IndexNameProvider(); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/opensearch/data/client/repositories/geo/GeoRepositoryORHLCIntegrationTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | * 5 | * The OpenSearch Contributors require contributions made to 6 | * this file be licensed under the Apache-2.0 license or a 7 | * compatible open source license. 8 | */ 9 | 10 | package org.opensearch.data.client.repositories.geo; 11 | 12 | import org.opensearch.data.client.junit.jupiter.OpenSearchRestTemplateConfiguration; 13 | import org.springframework.context.annotation.Bean; 14 | import org.springframework.context.annotation.Configuration; 15 | import org.springframework.context.annotation.Import; 16 | import org.springframework.data.elasticsearch.repositories.geo.GeoRepositoryIntegrationTests; 17 | import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories; 18 | import org.springframework.data.elasticsearch.utils.IndexNameProvider; 19 | import org.springframework.test.context.ContextConfiguration; 20 | 21 | @ContextConfiguration(classes = {GeoRepositoryORHLCIntegrationTests.Config.class}) 22 | public class GeoRepositoryORHLCIntegrationTests extends GeoRepositoryIntegrationTests { 23 | @Configuration 24 | @Import({OpenSearchRestTemplateConfiguration.class}) 25 | @EnableElasticsearchRepositories( 26 | basePackages = {"org.springframework.data.elasticsearch.repositories.geo"}, 27 | considerNestedRepositories = true) 28 | static class Config { 29 | @Bean 30 | IndexNameProvider indexNameProvider() { 31 | return new IndexNameProvider("geo-repository-os"); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/opensearch/data/client/repositories/geo/GeoRepositoryOSCIntegrationTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | * 5 | * The OpenSearch Contributors require contributions made to 6 | * this file be licensed under the Apache-2.0 license or a 7 | * compatible open source license. 8 | */ 9 | 10 | package org.opensearch.data.client.repositories.geo; 11 | 12 | import org.opensearch.data.client.junit.jupiter.OpenSearchTemplateConfiguration; 13 | import org.springframework.context.annotation.Bean; 14 | import org.springframework.context.annotation.Configuration; 15 | import org.springframework.context.annotation.Import; 16 | import org.springframework.data.elasticsearch.repositories.geo.GeoRepositoryIntegrationTests; 17 | import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories; 18 | import org.springframework.data.elasticsearch.utils.IndexNameProvider; 19 | import org.springframework.test.context.ContextConfiguration; 20 | 21 | @ContextConfiguration(classes = {GeoRepositoryOSCIntegrationTests.Config.class}) 22 | public class GeoRepositoryOSCIntegrationTests extends GeoRepositoryIntegrationTests { 23 | @Configuration 24 | @Import({OpenSearchTemplateConfiguration.class}) 25 | @EnableElasticsearchRepositories( 26 | basePackages = {"org.springframework.data.elasticsearch.repositories.geo"}, 27 | considerNestedRepositories = true) 28 | static class Config { 29 | @Bean 30 | IndexNameProvider indexNameProvider() { 31 | return new IndexNameProvider("geo-repository-os"); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/opensearch/data/client/repositories/integer/IntegerIDRepositoryORHLCIntegrationTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | * 5 | * The OpenSearch Contributors require contributions made to 6 | * this file be licensed under the Apache-2.0 license or a 7 | * compatible open source license. 8 | */ 9 | 10 | package org.opensearch.data.client.repositories.integer; 11 | 12 | import org.opensearch.data.client.junit.jupiter.OpenSearchRestTemplateConfiguration; 13 | import org.springframework.context.annotation.Bean; 14 | import org.springframework.context.annotation.Configuration; 15 | import org.springframework.context.annotation.Import; 16 | import org.springframework.data.elasticsearch.repositories.integer.IntegerIDRepositoryIntegrationTests; 17 | import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories; 18 | import org.springframework.data.elasticsearch.utils.IndexNameProvider; 19 | import org.springframework.test.context.ContextConfiguration; 20 | 21 | @ContextConfiguration(classes = {IntegerIDRepositoryORHLCIntegrationTests.Config.class}) 22 | public class IntegerIDRepositoryORHLCIntegrationTests extends IntegerIDRepositoryIntegrationTests { 23 | 24 | @Configuration 25 | @Import({OpenSearchRestTemplateConfiguration.class}) 26 | @EnableElasticsearchRepositories( 27 | basePackages = {"org.springframework.data.elasticsearch.repositories.integer"}, 28 | considerNestedRepositories = true) 29 | static class Config { 30 | @Bean 31 | IndexNameProvider indexNameProvider() { 32 | return new IndexNameProvider("integerid-repository-es7"); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/opensearch/data/client/repositories/integer/IntegerIDRepositoryOSCIntegrationTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | * 5 | * The OpenSearch Contributors require contributions made to 6 | * this file be licensed under the Apache-2.0 license or a 7 | * compatible open source license. 8 | */ 9 | 10 | package org.opensearch.data.client.repositories.integer; 11 | 12 | import org.opensearch.data.client.junit.jupiter.OpenSearchTemplateConfiguration; 13 | import org.springframework.context.annotation.Bean; 14 | import org.springframework.context.annotation.Configuration; 15 | import org.springframework.context.annotation.Import; 16 | import org.springframework.data.elasticsearch.repositories.integer.IntegerIDRepositoryIntegrationTests; 17 | import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories; 18 | import org.springframework.data.elasticsearch.utils.IndexNameProvider; 19 | import org.springframework.test.context.ContextConfiguration; 20 | 21 | @ContextConfiguration(classes = {IntegerIDRepositoryOSCIntegrationTests.Config.class}) 22 | public class IntegerIDRepositoryOSCIntegrationTests extends IntegerIDRepositoryIntegrationTests { 23 | 24 | @Configuration 25 | @Import({OpenSearchTemplateConfiguration.class}) 26 | @EnableElasticsearchRepositories( 27 | basePackages = {"org.springframework.data.elasticsearch.repositories.integer"}, 28 | considerNestedRepositories = true) 29 | static class Config { 30 | @Bean 31 | IndexNameProvider indexNameProvider() { 32 | return new IndexNameProvider("integerid-repository-es7"); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/opensearch/data/client/repositories/nestedobject/InnerObjectORHLCIntegrationTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | * 5 | * The OpenSearch Contributors require contributions made to 6 | * this file be licensed under the Apache-2.0 license or a 7 | * compatible open source license. 8 | */ 9 | 10 | package org.opensearch.data.client.repositories.nestedobject; 11 | 12 | import org.opensearch.data.client.junit.jupiter.OpenSearchRestTemplateConfiguration; 13 | import org.springframework.context.annotation.Bean; 14 | import org.springframework.context.annotation.Configuration; 15 | import org.springframework.context.annotation.Import; 16 | import org.springframework.data.elasticsearch.repositories.nestedobject.InnerObjectIntegrationTests; 17 | import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories; 18 | import org.springframework.data.elasticsearch.utils.IndexNameProvider; 19 | import org.springframework.test.context.ContextConfiguration; 20 | 21 | @ContextConfiguration(classes = {InnerObjectORHLCIntegrationTests.Config.class}) 22 | public class InnerObjectORHLCIntegrationTests extends InnerObjectIntegrationTests { 23 | @Configuration 24 | @Import({OpenSearchRestTemplateConfiguration.class}) 25 | @EnableElasticsearchRepositories( 26 | basePackages = {"org.springframework.data.elasticsearch.repositories.nestedobject"}, 27 | considerNestedRepositories = true) 28 | static class Config { 29 | @Bean 30 | IndexNameProvider indexNameProvider() { 31 | return new IndexNameProvider("inner-object-os"); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/opensearch/data/client/repositories/nestedobject/InnerObjectOSCIntegrationTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | * 5 | * The OpenSearch Contributors require contributions made to 6 | * this file be licensed under the Apache-2.0 license or a 7 | * compatible open source license. 8 | */ 9 | 10 | package org.opensearch.data.client.repositories.nestedobject; 11 | 12 | import org.opensearch.data.client.junit.jupiter.OpenSearchTemplateConfiguration; 13 | import org.springframework.context.annotation.Bean; 14 | import org.springframework.context.annotation.Configuration; 15 | import org.springframework.context.annotation.Import; 16 | import org.springframework.data.elasticsearch.repositories.nestedobject.InnerObjectIntegrationTests; 17 | import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories; 18 | import org.springframework.data.elasticsearch.utils.IndexNameProvider; 19 | import org.springframework.test.context.ContextConfiguration; 20 | 21 | @ContextConfiguration(classes = {InnerObjectOSCIntegrationTests.Config.class}) 22 | public class InnerObjectOSCIntegrationTests extends InnerObjectIntegrationTests { 23 | @Configuration 24 | @Import({OpenSearchTemplateConfiguration.class}) 25 | @EnableElasticsearchRepositories( 26 | basePackages = {"org.springframework.data.elasticsearch.repositories.nestedobject"}, 27 | considerNestedRepositories = true) 28 | static class Config { 29 | @Bean 30 | IndexNameProvider indexNameProvider() { 31 | return new IndexNameProvider("inner-object-os"); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/opensearch/data/client/repositories/setting/fielddynamic/FieldDynamicMappingEntityRepositoryOSCIntegrationTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | * 5 | * The OpenSearch Contributors require contributions made to 6 | * this file be licensed under the Apache-2.0 license or a 7 | * compatible open source license. 8 | */ 9 | 10 | package org.opensearch.data.client.repositories.setting.fielddynamic; 11 | 12 | import org.opensearch.data.client.junit.jupiter.OpenSearchTemplateConfiguration; 13 | import org.springframework.context.annotation.Bean; 14 | import org.springframework.context.annotation.Configuration; 15 | import org.springframework.context.annotation.Import; 16 | import org.springframework.data.elasticsearch.repositories.setting.fielddynamic.FieldDynamicMappingEntityRepositoryIntegrationTests; 17 | import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories; 18 | import org.springframework.data.elasticsearch.utils.IndexNameProvider; 19 | import org.springframework.test.context.ContextConfiguration; 20 | 21 | @ContextConfiguration(classes = {FieldDynamicMappingEntityRepositoryOSCIntegrationTests.Config.class}) 22 | public class FieldDynamicMappingEntityRepositoryOSCIntegrationTests 23 | extends FieldDynamicMappingEntityRepositoryIntegrationTests { 24 | 25 | @Configuration 26 | @Import({OpenSearchTemplateConfiguration.class}) 27 | @EnableElasticsearchRepositories( 28 | basePackages = {"org.springframework.data.elasticsearch.repositories.setting.fielddynamic"}, 29 | considerNestedRepositories = true) 30 | static class Config { 31 | @Bean 32 | IndexNameProvider indexNameProvider() { 33 | return new IndexNameProvider("field-dynamic-mapping-os"); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/opensearch/data/client/repositories/spel/SpELEntityORHLCIntegrationTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | * 5 | * The OpenSearch Contributors require contributions made to 6 | * this file be licensed under the Apache-2.0 license or a 7 | * compatible open source license. 8 | */ 9 | 10 | package org.opensearch.data.client.repositories.spel; 11 | 12 | import org.opensearch.data.client.junit.jupiter.OpenSearchRestTemplateConfiguration; 13 | import org.springframework.context.annotation.Bean; 14 | import org.springframework.context.annotation.Configuration; 15 | import org.springframework.context.annotation.Import; 16 | import org.springframework.data.elasticsearch.repositories.spel.SpELEntityIntegrationTests; 17 | import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories; 18 | import org.springframework.data.elasticsearch.utils.IndexNameProvider; 19 | import org.springframework.test.context.ContextConfiguration; 20 | 21 | @ContextConfiguration(classes = {SpELEntityORHLCIntegrationTests.Config.class}) 22 | public class SpELEntityORHLCIntegrationTests extends SpELEntityIntegrationTests { 23 | @Configuration 24 | @Import(OpenSearchRestTemplateConfiguration.class) 25 | @EnableElasticsearchRepositories( 26 | basePackages = {"org.springframework.data.elasticsearch.repositories.spel"}, 27 | considerNestedRepositories = true) 28 | static class Config { 29 | @Bean 30 | IndexNameProvider indexNameProvider() { 31 | return new IndexNameProvider("spel-entity-os"); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/opensearch/data/client/repositories/spel/SpELEntityOSCIntegrationTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | * 5 | * The OpenSearch Contributors require contributions made to 6 | * this file be licensed under the Apache-2.0 license or a 7 | * compatible open source license. 8 | */ 9 | 10 | package org.opensearch.data.client.repositories.spel; 11 | 12 | import org.opensearch.data.client.junit.jupiter.OpenSearchTemplateConfiguration; 13 | import org.springframework.context.annotation.Bean; 14 | import org.springframework.context.annotation.Configuration; 15 | import org.springframework.context.annotation.Import; 16 | import org.springframework.data.elasticsearch.repositories.spel.SpELEntityIntegrationTests; 17 | import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories; 18 | import org.springframework.data.elasticsearch.utils.IndexNameProvider; 19 | import org.springframework.test.context.ContextConfiguration; 20 | 21 | @ContextConfiguration(classes = {SpELEntityOSCIntegrationTests.Config.class}) 22 | public class SpELEntityOSCIntegrationTests extends SpELEntityIntegrationTests { 23 | @Configuration 24 | @Import(OpenSearchTemplateConfiguration.class) 25 | @EnableElasticsearchRepositories( 26 | basePackages = {"org.springframework.data.elasticsearch.repositories.spel"}, 27 | considerNestedRepositories = true) 28 | static class Config { 29 | @Bean 30 | IndexNameProvider indexNameProvider() { 31 | return new IndexNameProvider("spel-entity-os"); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/opensearch/data/client/repositories/synonym/SynonymRepositoryORHLCIntegrationTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | * 5 | * The OpenSearch Contributors require contributions made to 6 | * this file be licensed under the Apache-2.0 license or a 7 | * compatible open source license. 8 | */ 9 | 10 | package org.opensearch.data.client.repositories.synonym; 11 | 12 | import org.opensearch.data.client.junit.jupiter.OpenSearchRestTemplateConfiguration; 13 | import org.springframework.context.annotation.Bean; 14 | import org.springframework.context.annotation.Configuration; 15 | import org.springframework.context.annotation.Import; 16 | import org.springframework.data.elasticsearch.repositories.synonym.SynonymRepositoryIntegrationTests; 17 | import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories; 18 | import org.springframework.data.elasticsearch.utils.IndexNameProvider; 19 | import org.springframework.test.context.ContextConfiguration; 20 | 21 | @ContextConfiguration(classes = {SynonymRepositoryORHLCIntegrationTests.Config.class}) 22 | public class SynonymRepositoryORHLCIntegrationTests extends SynonymRepositoryIntegrationTests { 23 | @Configuration 24 | @Import({OpenSearchRestTemplateConfiguration.class}) 25 | @EnableElasticsearchRepositories( 26 | basePackages = {"org.springframework.data.elasticsearch.repositories.synonym"}, 27 | considerNestedRepositories = true) 28 | static class Config { 29 | @Bean 30 | IndexNameProvider indexNameProvider() { 31 | return new IndexNameProvider("sysnonym-entity-os"); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/opensearch/data/client/repositories/synonym/SynonymRepositoryOSCIntegrationTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | * 5 | * The OpenSearch Contributors require contributions made to 6 | * this file be licensed under the Apache-2.0 license or a 7 | * compatible open source license. 8 | */ 9 | 10 | package org.opensearch.data.client.repositories.synonym; 11 | 12 | import org.opensearch.data.client.junit.jupiter.OpenSearchTemplateConfiguration; 13 | import org.springframework.context.annotation.Bean; 14 | import org.springframework.context.annotation.Configuration; 15 | import org.springframework.context.annotation.Import; 16 | import org.springframework.data.elasticsearch.repositories.synonym.SynonymRepositoryIntegrationTests; 17 | import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories; 18 | import org.springframework.data.elasticsearch.utils.IndexNameProvider; 19 | import org.springframework.test.context.ContextConfiguration; 20 | 21 | @ContextConfiguration(classes = {SynonymRepositoryOSCIntegrationTests.Config.class}) 22 | public class SynonymRepositoryOSCIntegrationTests extends SynonymRepositoryIntegrationTests { 23 | @Configuration 24 | @Import({OpenSearchTemplateConfiguration.class}) 25 | @EnableElasticsearchRepositories( 26 | basePackages = {"org.springframework.data.elasticsearch.repositories.synonym"}, 27 | considerNestedRepositories = true) 28 | static class Config { 29 | @Bean 30 | IndexNameProvider indexNameProvider() { 31 | return new IndexNameProvider("sysnonym-entity-os"); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/opensearch/data/client/repositories/uuidkeyed/UUIDElasticsearchRepositoryORHLCIntegrationTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | * 5 | * The OpenSearch Contributors require contributions made to 6 | * this file be licensed under the Apache-2.0 license or a 7 | * compatible open source license. 8 | */ 9 | 10 | package org.opensearch.data.client.repositories.uuidkeyed; 11 | 12 | import org.opensearch.data.client.junit.jupiter.OpenSearchRestTemplateConfiguration; 13 | import org.springframework.context.annotation.Bean; 14 | import org.springframework.context.annotation.Configuration; 15 | import org.springframework.context.annotation.Import; 16 | import org.springframework.data.elasticsearch.repositories.uuidkeyed.UUIDElasticsearchRepositoryIntegrationTests; 17 | import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories; 18 | import org.springframework.data.elasticsearch.utils.IndexNameProvider; 19 | import org.springframework.test.context.ContextConfiguration; 20 | 21 | @ContextConfiguration(classes = {UUIDElasticsearchRepositoryORHLCIntegrationTests.Config.class}) 22 | public class UUIDElasticsearchRepositoryORHLCIntegrationTests extends UUIDElasticsearchRepositoryIntegrationTests { 23 | @Configuration 24 | @Import({OpenSearchRestTemplateConfiguration.class}) 25 | @EnableElasticsearchRepositories( 26 | basePackages = {"org.springframework.data.elasticsearch.repositories.uuidkeyed"}, 27 | considerNestedRepositories = true) 28 | static class Config { 29 | @Bean 30 | IndexNameProvider indexNameProvider() { 31 | return new IndexNameProvider("uuid-keyed-os"); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/opensearch/data/client/repositories/uuidkeyed/UUIDElasticsearchRepositoryOSCIntegrationTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | * 5 | * The OpenSearch Contributors require contributions made to 6 | * this file be licensed under the Apache-2.0 license or a 7 | * compatible open source license. 8 | */ 9 | 10 | package org.opensearch.data.client.repositories.uuidkeyed; 11 | 12 | import org.opensearch.data.client.junit.jupiter.OpenSearchTemplateConfiguration; 13 | import org.springframework.context.annotation.Bean; 14 | import org.springframework.context.annotation.Configuration; 15 | import org.springframework.context.annotation.Import; 16 | import org.springframework.data.elasticsearch.repositories.uuidkeyed.UUIDElasticsearchRepositoryIntegrationTests; 17 | import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories; 18 | import org.springframework.data.elasticsearch.utils.IndexNameProvider; 19 | import org.springframework.test.context.ContextConfiguration; 20 | 21 | @ContextConfiguration(classes = {UUIDElasticsearchRepositoryOSCIntegrationTests.Config.class}) 22 | public class UUIDElasticsearchRepositoryOSCIntegrationTests extends UUIDElasticsearchRepositoryIntegrationTests { 23 | @Configuration 24 | @Import({OpenSearchTemplateConfiguration.class}) 25 | @EnableElasticsearchRepositories( 26 | basePackages = {"org.springframework.data.elasticsearch.repositories.uuidkeyed"}, 27 | considerNestedRepositories = true) 28 | static class Config { 29 | @Bean 30 | IndexNameProvider indexNameProvider() { 31 | return new IndexNameProvider("uuid-keyed-os"); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/opensearch/data/client/repository/support/ElasticsearchRepositoryORHLCIntegrationTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | * 5 | * The OpenSearch Contributors require contributions made to 6 | * this file be licensed under the Apache-2.0 license or a 7 | * compatible open source license. 8 | */ 9 | 10 | package org.opensearch.data.client.repository.support; 11 | 12 | import org.opensearch.data.client.junit.jupiter.OpenSearchRestTemplateConfiguration; 13 | import org.springframework.context.annotation.Bean; 14 | import org.springframework.context.annotation.Configuration; 15 | import org.springframework.context.annotation.Import; 16 | import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories; 17 | import org.springframework.data.elasticsearch.repository.support.ElasticsearchRepositoryIntegrationTests; 18 | import org.springframework.data.elasticsearch.utils.IndexNameProvider; 19 | import org.springframework.test.context.ContextConfiguration; 20 | 21 | @ContextConfiguration(classes = {ElasticsearchRepositoryORHLCIntegrationTests.Config.class}) 22 | public class ElasticsearchRepositoryORHLCIntegrationTests extends ElasticsearchRepositoryIntegrationTests { 23 | 24 | @Configuration 25 | @Import({OpenSearchRestTemplateConfiguration.class}) 26 | @EnableElasticsearchRepositories( 27 | basePackages = {"org.springframework.data.elasticsearch.repository.support"}, 28 | considerNestedRepositories = true) 29 | static class Config { 30 | @Bean 31 | IndexNameProvider indexNameProvider() { 32 | return new IndexNameProvider("repository-os"); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/opensearch/data/client/repository/support/ElasticsearchRepositoryOSCIntegrationTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | * 5 | * The OpenSearch Contributors require contributions made to 6 | * this file be licensed under the Apache-2.0 license or a 7 | * compatible open source license. 8 | */ 9 | 10 | package org.opensearch.data.client.repository.support; 11 | 12 | import org.opensearch.data.client.junit.jupiter.OpenSearchTemplateConfiguration; 13 | import org.springframework.context.annotation.Bean; 14 | import org.springframework.context.annotation.Configuration; 15 | import org.springframework.context.annotation.Import; 16 | import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories; 17 | import org.springframework.data.elasticsearch.repository.support.ElasticsearchRepositoryIntegrationTests; 18 | import org.springframework.data.elasticsearch.utils.IndexNameProvider; 19 | import org.springframework.test.context.ContextConfiguration; 20 | 21 | @ContextConfiguration(classes = {ElasticsearchRepositoryOSCIntegrationTests.Config.class}) 22 | public class ElasticsearchRepositoryOSCIntegrationTests extends ElasticsearchRepositoryIntegrationTests { 23 | 24 | @Configuration 25 | @Import({OpenSearchTemplateConfiguration.class}) 26 | @EnableElasticsearchRepositories( 27 | basePackages = {"org.springframework.data.elasticsearch.repository.support"}, 28 | considerNestedRepositories = true) 29 | static class Config { 30 | @Bean 31 | IndexNameProvider indexNameProvider() { 32 | return new IndexNameProvider("repository-os"); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/springframework/data/elasticsearch/config/notnested/SampleElasticsearchRepository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2022 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.springframework.data.elasticsearch.config.notnested; 17 | 18 | import java.util.List; 19 | 20 | import org.springframework.data.elasticsearch.repository.ElasticsearchRepository; 21 | 22 | /** 23 | * @author Rizwan Idrees 24 | * @author Mohsin Husen 25 | * @author Christoph Strobl 26 | */ 27 | public interface SampleElasticsearchRepository 28 | extends ElasticsearchRepository { 29 | 30 | long deleteSampleEntityById(String id); 31 | 32 | List deleteByAvailable(boolean available); 33 | 34 | List deleteByMessage(String message); 35 | 36 | void deleteByType(String type); 37 | 38 | } 39 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/springframework/data/elasticsearch/config/notnested/SampleUUIDKeyedElasticsearchRepository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018-2022 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.springframework.data.elasticsearch.config.notnested; 17 | 18 | import java.util.List; 19 | import java.util.UUID; 20 | 21 | import org.springframework.data.elasticsearch.repository.ElasticsearchRepository; 22 | 23 | /** 24 | * @author Gad Akuka 25 | * @author Christoph Strobl 26 | */ 27 | interface SampleUUIDKeyedElasticsearchRepository 28 | extends ElasticsearchRepository { 29 | 30 | long deleteSampleEntityUUIDKeyedById(UUID id); 31 | 32 | List deleteByAvailable(boolean available); 33 | 34 | List deleteByMessage(String message); 35 | 36 | void deleteByType(String type); 37 | 38 | } 39 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/springframework/data/elasticsearch/config/notnested/package-info.java: -------------------------------------------------------------------------------- 1 | @org.springframework.lang.NonNullApi 2 | @org.springframework.lang.NonNullFields 3 | package org.springframework.data.elasticsearch.config.notnested; 4 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/springframework/data/elasticsearch/core/paginating/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Test for paginating support with search_after and point_in_time API 3 | */ 4 | @org.springframework.lang.NonNullApi 5 | @org.springframework.lang.NonNullFields 6 | package org.springframework.data.elasticsearch.core.paginating; 7 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/springframework/data/elasticsearch/junit/jupiter/ClusterConnectionException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2022 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.springframework.data.elasticsearch.junit.jupiter; 17 | 18 | /** 19 | * @author Peter-Josef Meisch 20 | */ 21 | public class ClusterConnectionException extends RuntimeException { 22 | public ClusterConnectionException(String message) { 23 | super(message); 24 | } 25 | 26 | public ClusterConnectionException(Throwable cause) { 27 | super(cause); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/springframework/data/elasticsearch/junit/jupiter/IntegrationTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2022 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.springframework.data.elasticsearch.junit.jupiter; 17 | 18 | import java.lang.annotation.ElementType; 19 | import java.lang.annotation.Retention; 20 | import java.lang.annotation.RetentionPolicy; 21 | import java.lang.annotation.Target; 22 | 23 | import org.junit.jupiter.api.Tag; 24 | import org.junit.jupiter.api.extension.ExtendWith; 25 | 26 | /** 27 | * Wraps the {@link SpringDataElasticsearchExtension}. 28 | * 29 | * @author Peter-Josef Meisch 30 | */ 31 | @Retention(RetentionPolicy.RUNTIME) 32 | @Target(ElementType.TYPE) 33 | @ExtendWith(SpringDataElasticsearchExtension.class) 34 | @Tag(Tags.INTEGRATION_TEST) 35 | public @interface IntegrationTest { 36 | } 37 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/springframework/data/elasticsearch/junit/jupiter/IntegrationtestEnvironment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021-2022 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.springframework.data.elasticsearch.junit.jupiter; 17 | 18 | /** 19 | * @author Peter-Josef Meisch 20 | */ 21 | public enum IntegrationtestEnvironment { 22 | 23 | ELASTICSEARCH, OPENSEARCH, UNDEFINED; 24 | 25 | public static final String SYSTEM_PROPERTY = "sde.integration-test.environment"; 26 | 27 | public static IntegrationtestEnvironment get() { 28 | 29 | String property = System.getProperty(SYSTEM_PROPERTY, "elasticsearch"); 30 | return switch (property.toUpperCase()) { 31 | case "ELASTICSEARCH" -> ELASTICSEARCH; 32 | case "OPENSEARCH" -> OPENSEARCH; 33 | default -> UNDEFINED; 34 | }; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/springframework/data/elasticsearch/junit/jupiter/Tags.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020-2022 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.springframework.data.elasticsearch.junit.jupiter; 17 | 18 | /** 19 | * @author Peter-Josef Meisch 20 | */ 21 | public interface Tags { 22 | String INTEGRATION_TEST = "integration-test"; 23 | } 24 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/springframework/data/elasticsearch/junit/jupiter/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * interfaces, annotations and classes related to JUnit 5 test handling. 3 | */ 4 | @org.springframework.lang.NonNullApi 5 | package org.springframework.data.elasticsearch.junit.jupiter; 6 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/springframework/data/elasticsearch/repositories/cdi/CdiProductRepository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2022 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.springframework.data.elasticsearch.repositories.cdi; 17 | 18 | import java.util.Optional; 19 | 20 | import org.springframework.data.repository.CrudRepository; 21 | 22 | /** 23 | * @author Mohsin Husen 24 | * @author Oliver Gierke 25 | * @author Mark Paluch 26 | * @author Christoph Strobl 27 | */ 28 | public interface CdiProductRepository extends CrudRepository { 29 | 30 | @Override 31 | Optional findById(String id); 32 | } 33 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/springframework/data/elasticsearch/repositories/cdi/OtherQualifier.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016-2022 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.springframework.data.elasticsearch.repositories.cdi; 18 | 19 | import java.lang.annotation.ElementType; 20 | import java.lang.annotation.Retention; 21 | import java.lang.annotation.RetentionPolicy; 22 | import java.lang.annotation.Target; 23 | 24 | import jakarta.inject.Qualifier; 25 | 26 | /** 27 | * @author Mark Paluch 28 | * @see DATAES-234 29 | */ 30 | @Qualifier 31 | @Retention(RetentionPolicy.RUNTIME) 32 | @Target({ ElementType.TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER }) 33 | public @interface OtherQualifier { 34 | 35 | } 36 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/springframework/data/elasticsearch/repositories/cdi/PersonDB.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016-2022 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.springframework.data.elasticsearch.repositories.cdi; 18 | 19 | import java.lang.annotation.ElementType; 20 | import java.lang.annotation.Retention; 21 | import java.lang.annotation.RetentionPolicy; 22 | import java.lang.annotation.Target; 23 | 24 | import jakarta.inject.Qualifier; 25 | 26 | /** 27 | * @author Mark Paluch 28 | * @see DATAES-234 29 | */ 30 | @Qualifier 31 | @Retention(RetentionPolicy.RUNTIME) 32 | @Target({ ElementType.TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER }) 33 | public @interface PersonDB { 34 | 35 | } 36 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/springframework/data/elasticsearch/repositories/cdi/QualifiedProductRepository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016-2022 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.springframework.data.elasticsearch.repositories.cdi; 17 | 18 | import org.springframework.data.repository.CrudRepository; 19 | 20 | /** 21 | * @author Mark Paluch 22 | * @see DATAES-234 23 | */ 24 | @PersonDB 25 | @OtherQualifier 26 | public interface QualifiedProductRepository extends CrudRepository { 27 | 28 | } 29 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/springframework/data/elasticsearch/repositories/cdi/SamplePersonRepository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2022 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.springframework.data.elasticsearch.repositories.cdi; 17 | 18 | import org.springframework.data.repository.Repository; 19 | 20 | /** 21 | * @author Mark Paluch 22 | * @see DATAES-113 23 | */ 24 | public interface SamplePersonRepository 25 | extends Repository, SamplePersonRepositoryCustom { 26 | 27 | } 28 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/springframework/data/elasticsearch/repositories/cdi/SamplePersonRepositoryCustom.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2022 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.springframework.data.elasticsearch.repositories.cdi; 18 | 19 | /** 20 | * @author Mark Paluch 21 | * @see DATAES-113 22 | */ 23 | interface SamplePersonRepositoryCustom { 24 | 25 | int returnOne(); 26 | } 27 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/springframework/data/elasticsearch/repositories/cdi/SamplePersonRepositoryImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2022 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.springframework.data.elasticsearch.repositories.cdi; 18 | 19 | /** 20 | * @author Mark Paluch 21 | * @see DATAES-113 22 | */ 23 | class SamplePersonRepositoryImpl implements SamplePersonRepositoryCustom { 24 | 25 | @Override 26 | public int returnOne() { 27 | return 1; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/springframework/data/elasticsearch/repositories/cdi/package-info.java: -------------------------------------------------------------------------------- 1 | @org.springframework.lang.NonNullApi 2 | @org.springframework.lang.NonNullFields 3 | package org.springframework.data.elasticsearch.repositories.cdi; 4 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/springframework/data/elasticsearch/repositories/complex/custommethod/autowiring/ComplexElasticsearchRepository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2022 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.springframework.data.elasticsearch.repositories.complex.custommethod.autowiring; 17 | 18 | import org.springframework.data.elasticsearch.repository.ElasticsearchRepository; 19 | 20 | /** 21 | * @author Artur Konczak 22 | */ 23 | public interface ComplexElasticsearchRepository 24 | extends ElasticsearchRepository, 25 | ComplexElasticsearchRepositoryCustom { 26 | 27 | } 28 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/springframework/data/elasticsearch/repositories/complex/custommethod/autowiring/ComplexElasticsearchRepositoryCustom.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2022 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.springframework.data.elasticsearch.repositories.complex.custommethod.autowiring; 17 | 18 | /** 19 | * @author Artur Konczak 20 | * @author Mohsin Husen 21 | */ 22 | public interface ComplexElasticsearchRepositoryCustom { 23 | 24 | String doSomethingSpecial(); 25 | } 26 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/springframework/data/elasticsearch/repositories/complex/custommethod/autowiring/ComplexElasticsearchRepositoryImpl.java: -------------------------------------------------------------------------------- 1 | package org.springframework.data.elasticsearch.repositories.complex.custommethod.autowiring; 2 | 3 | import static org.assertj.core.api.AssertionsForClassTypes.*; 4 | 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.data.elasticsearch.core.ElasticsearchOperations; 7 | 8 | /** 9 | * @author Artur Konczak 10 | * @author Peter-Josef Meisch 11 | */ 12 | public class ComplexElasticsearchRepositoryImpl implements ComplexElasticsearchRepositoryCustom { 13 | 14 | @Autowired private ElasticsearchOperations operations; 15 | 16 | @Override 17 | public String doSomethingSpecial() { 18 | 19 | assertThat(operations.getElasticsearchConverter()).isNotNull(); 20 | 21 | return "2+2=4"; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/springframework/data/elasticsearch/repositories/complex/custommethod/manualwiring/ComplexElasticsearchRepositoryCustom.java: -------------------------------------------------------------------------------- 1 | package org.springframework.data.elasticsearch.repositories.complex.custommethod.manualwiring; 2 | 3 | /** 4 | * @author Artur Konczak 5 | * @author Mohsin Husen 6 | */ 7 | interface ComplexElasticsearchRepositoryCustom { 8 | 9 | String doSomethingSpecial(); 10 | } 11 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/springframework/data/elasticsearch/repositories/complex/custommethod/manualwiring/ComplexElasticsearchRepositoryManualWiring.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2022 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.springframework.data.elasticsearch.repositories.complex.custommethod.manualwiring; 17 | 18 | import org.springframework.data.elasticsearch.repositories.complex.custommethod.autowiring.ComplexElasticsearchRepositoryCustom; 19 | import org.springframework.data.elasticsearch.repository.ElasticsearchRepository; 20 | 21 | /** 22 | * @author Artur Konczak 23 | */ 24 | public interface ComplexElasticsearchRepositoryManualWiring 25 | extends ElasticsearchRepository, 26 | ComplexElasticsearchRepositoryCustom { 27 | 28 | } 29 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/springframework/data/elasticsearch/repositories/complex/custommethod/manualwiring/ComplexElasticsearchRepositoryManualWiringImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2022 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.springframework.data.elasticsearch.repositories.complex.custommethod.manualwiring; 17 | 18 | import static org.assertj.core.api.AssertionsForClassTypes.*; 19 | 20 | import org.springframework.data.elasticsearch.core.ElasticsearchOperations; 21 | import org.springframework.data.elasticsearch.repositories.complex.custommethod.autowiring.ComplexElasticsearchRepositoryCustom; 22 | 23 | /** 24 | * @author Artur Konczak 25 | * @author Mohsin Husen 26 | * @author Peter-Josef Meisch 27 | */ 28 | public class ComplexElasticsearchRepositoryManualWiringImpl implements ComplexElasticsearchRepositoryCustom { 29 | 30 | private ElasticsearchOperations operations; 31 | 32 | public ComplexElasticsearchRepositoryManualWiringImpl(ElasticsearchOperations operations) { 33 | this.operations = operations; 34 | } 35 | 36 | @Override 37 | public String doSomethingSpecial() { 38 | 39 | assertThat(operations.getElasticsearchConverter()).isNotNull(); 40 | 41 | return "3+3=6"; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/springframework/data/elasticsearch/utils/IdGenerator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020-2022 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.springframework.data.elasticsearch.utils; 17 | 18 | import java.util.concurrent.atomic.AtomicInteger; 19 | 20 | /** 21 | * Class to provide sequential IDs. Uses an integer, 2^31 -1 values should be enough for the test runs. 22 | * 23 | * @author Peter-Josef Meisch 24 | */ 25 | public final class IdGenerator { 26 | 27 | private static final AtomicInteger NEXT = new AtomicInteger(); 28 | 29 | private IdGenerator() {} 30 | 31 | public static int nextIdAsInt() { 32 | return NEXT.incrementAndGet(); 33 | } 34 | 35 | public static double nextIdAsDouble() { 36 | return NEXT.incrementAndGet(); 37 | } 38 | 39 | public static String nextIdAsString() { 40 | return "" + nextIdAsInt(); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/springframework/data/elasticsearch/utils/IndexBuilder.java: -------------------------------------------------------------------------------- 1 | package org.springframework.data.elasticsearch.utils; 2 | 3 | import java.lang.reflect.Field; 4 | 5 | import org.springframework.core.annotation.AnnotationUtils; 6 | import org.springframework.data.annotation.Id; 7 | import org.springframework.data.elasticsearch.core.query.IndexQuery; 8 | 9 | /** 10 | * Created by akonczak on 02/12/2015. 11 | * 12 | * @author Peter-Josef Meisch 13 | */ 14 | public class IndexBuilder { 15 | 16 | public static IndexQuery buildIndex(Object object) { 17 | for (Field f : object.getClass().getDeclaredFields()) { 18 | 19 | if (AnnotationUtils.findAnnotation(f, Id.class) != null) { 20 | try { 21 | f.setAccessible(true); 22 | IndexQuery indexQuery = new IndexQuery(); 23 | indexQuery.setId((String) f.get(object)); 24 | indexQuery.setObject(object); 25 | return indexQuery; 26 | } catch (IllegalAccessException e) { 27 | e.printStackTrace(); 28 | } 29 | } 30 | } 31 | throw new RuntimeException("Missing @Id field"); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/springframework/data/elasticsearch/utils/IndexInitializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2022 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.springframework.data.elasticsearch.utils; 17 | 18 | import org.springframework.data.elasticsearch.core.IndexOperations; 19 | 20 | /** 21 | * Utility to initialize indexes. 22 | * 23 | * @author Peter-Josef Meisch 24 | */ 25 | public class IndexInitializer { 26 | 27 | private IndexInitializer() {} 28 | 29 | /** 30 | * Initialize a fresh index with mappings for {@link Class}. Drops the index if it exists before creation. 31 | * 32 | * @param indexOperations 33 | */ 34 | public static void init(IndexOperations indexOperations) { 35 | indexOperations.delete(); 36 | indexOperations.create(); 37 | indexOperations.putMapping(indexOperations.createMapping()); 38 | indexOperations.refresh(); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/springframework/data/elasticsearch/utils/IndexNameProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021-2022 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.springframework.data.elasticsearch.utils; 17 | 18 | /** 19 | * Class providing an index name witInCo 20 | * 21 | * @author Peter-Josef Meisch 22 | */ 23 | public class IndexNameProvider { 24 | private final String prefix; 25 | private int idx = -1; 26 | private String indexName; 27 | 28 | public IndexNameProvider() { 29 | this("index-default"); 30 | } 31 | 32 | public IndexNameProvider(String prefix) { 33 | this.prefix = prefix; 34 | increment(); 35 | } 36 | 37 | public void increment() { 38 | indexName = prefix + '-' + ++idx; 39 | } 40 | 41 | public String indexName() { 42 | return indexName; 43 | } 44 | 45 | /** 46 | * @since 4.4 47 | */ 48 | public String getPrefix() { 49 | return prefix; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/springframework/data/elasticsearch/utils/geohash/Geometry.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.springframework.data.elasticsearch.utils.geohash; 17 | 18 | /** 19 | * Code copied from Elasticsearch 7.10, Apache License V2 20 | * https://github.com/elastic/elasticsearch/blob/7.10/libs/geo/src/main/java/org/elasticsearch/geometry/Geometry.java 21 | *
22 | *
23 | * Base class for all Geometry objects supported by elasticsearch 24 | */ 25 | public interface Geometry { 26 | 27 | ShapeType type(); 28 | 29 | T visit(GeometryVisitor visitor) throws E; 30 | 31 | boolean isEmpty(); 32 | 33 | default boolean hasZ() { 34 | return false; 35 | } 36 | 37 | default boolean hasAlt() { 38 | return hasZ(); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/springframework/data/elasticsearch/utils/geohash/GeometryValidator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.springframework.data.elasticsearch.utils.geohash; 17 | 18 | /** 19 | * /** Code copied from Elasticsearch 7.10, Apache License V2 20 | * https://github.com/elastic/elasticsearch/blob/7.10/libs/geo/src/main/java/org/elasticsearch/geometry/utils/GeometryValidator.java 21 | *
22 | *
23 | * Generic geometry validator that can be used by the parser to verify the validity of the parsed geometry 24 | */ 25 | public interface GeometryValidator { 26 | 27 | /** 28 | * Validates the geometry and throws IllegalArgumentException if the geometry is not valid 29 | */ 30 | void validate(Geometry geometry); 31 | 32 | } 33 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/springframework/data/elasticsearch/utils/geohash/ShapeType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.springframework.data.elasticsearch.utils.geohash; 17 | 18 | import java.util.Locale; 19 | 20 | /** 21 | * Code copied from Elasticsearch 7.10, Apache License V2 22 | * https://github.com/elastic/elasticsearch/blob/7.10/libs/geo/src/main/java/org/elasticsearch/geometry/ShapeType.java 23 | *
24 | *
25 | * Shape types supported by elasticsearch 26 | */ 27 | public enum ShapeType { 28 | POINT, // 29 | MULTIPOINT, // 30 | LINESTRING, // 31 | MULTILINESTRING, // 32 | POLYGON, // 33 | MULTIPOLYGON, // 34 | GEOMETRYCOLLECTION, // 35 | LINEARRING, // not serialized by itself in WKT or WKB 36 | ENVELOPE, // not part of the actual WKB spec 37 | CIRCLE; // not part of the actual WKB spec 38 | 39 | public static ShapeType forName(String shapeName) { 40 | return ShapeType.valueOf(shapeName.toUpperCase(Locale.ROOT)); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/java/org/springframework/data/elasticsearch/utils/geohash/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * package collecting classes needed for GeoHash calculations. Copied from Elasticsearch 7.10 code which was the last 19 | * one under the Apache license V2. 20 | * 21 | * @author Peter-Josef Meisch 22 | * @since 4.4 23 | */ 24 | package org.springframework.data.elasticsearch.utils.geohash; 25 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/resources/META-INF/beans.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/resources/META-INF/spring.factories: -------------------------------------------------------------------------------- 1 | org.springframework.test.context.ContextCustomizerFactory=org.springframework.data.elasticsearch.junit.jupiter.SpringDataElasticsearchExtension 2 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/resources/highlights/highlights-with-parameters.json: -------------------------------------------------------------------------------- 1 | { 2 | "boundary_chars": "#+*", 3 | "boundary_max_scan": 7, 4 | "boundary_scanner": "CHARS", 5 | "boundary_scanner_locale": "de-DE", 6 | "encoder": "html", 7 | "force_source": true, 8 | "fragmenter": "span", 9 | "fragment_size": 5, 10 | "no_match_size": 2, 11 | "number_of_fragments": 3, 12 | "order": "score", 13 | "phrase_limit": 42, 14 | "pre_tags": [ 15 | "", 16 | "" 17 | ], 18 | "post_tags": [ 19 | "", 20 | "" 21 | ], 22 | "require_field_match": false, 23 | "type": "plain", 24 | "fields": { 25 | "some-field": { 26 | "fragment_offset": 3, 27 | "number_of_fragments": 4, 28 | "matched_fields": [ 29 | "some-field", 30 | "other-field" 31 | ] 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/resources/highlights/highlights.json: -------------------------------------------------------------------------------- 1 | { 2 | "fields": { 3 | "some-field": {} 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/resources/local-maven-repo/org/projectlombok/lombok/999999/lombok-999999.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opensearch-project/spring-data-opensearch/6fd3cd3f501554b08df31958aea8e6f8821c8813/spring-data-opensearch/src/test/resources/local-maven-repo/org/projectlombok/lombok/999999/lombok-999999.jar -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/resources/local-maven-repo/org/projectlombok/lombok/999999/lombok-999999.jar.md5: -------------------------------------------------------------------------------- 1 | f6bbf833798e7af0055b94865a46440e -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/resources/local-maven-repo/org/projectlombok/lombok/999999/lombok-999999.jar.sha1: -------------------------------------------------------------------------------- 1 | 59ddfc2b714be7918808eacecc5739b8d277e60e -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/resources/local-maven-repo/org/projectlombok/lombok/999999/lombok-999999.pom: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | org.projectlombok 6 | lombok 7 | 999999 8 | 9 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/resources/local-maven-repo/org/projectlombok/lombok/999999/lombok-999999.pom.md5: -------------------------------------------------------------------------------- 1 | 63317ccd46b6663ff35cb142e05dce10 -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/resources/local-maven-repo/org/projectlombok/lombok/999999/lombok-999999.pom.sha1: -------------------------------------------------------------------------------- 1 | db353983c68ade94ae7e08acfacc0fc21ed8b64b -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/resources/local-maven-repo/org/projectlombok/lombok/maven-metadata.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.projectlombok 4 | lombok 5 | 6 | 999999 7 | 8 | 999999 9 | 10 | 20210321155422 11 | 12 | 13 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/resources/local-maven-repo/org/projectlombok/lombok/maven-metadata.xml.md5: -------------------------------------------------------------------------------- 1 | 998d3b8876980a3ef5a90adc982cc727 -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/resources/local-maven-repo/org/projectlombok/lombok/maven-metadata.xml.sha1: -------------------------------------------------------------------------------- 1 | f4090a49c6eec680c075130b68bf8ee48aac4e94 -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/resources/log4j2.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | %d %5p %c - %m%n 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/resources/mappings/test-dynamic_templates_mappings.json: -------------------------------------------------------------------------------- 1 | { 2 | "dynamic_templates": [ 3 | { 4 | "with_custom_analyzer": { 5 | "mapping": { 6 | "type": "string", 7 | "analyzer": "standard_lowercase_asciifolding" 8 | }, 9 | "path_match": "names.*" 10 | } 11 | } 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/resources/mappings/test-dynamic_templates_mappings_two.json: -------------------------------------------------------------------------------- 1 | { 2 | "dynamic_templates": [ 3 | { 4 | "with_custom_analyzer": { 5 | "mapping": { 6 | "type": "string", 7 | "analyzer": "standard_lowercase_asciifolding" 8 | }, 9 | "path_match": "names.*" 10 | } 11 | }, 12 | { 13 | "participantA1_with_custom_analyzer": { 14 | "mapping": { 15 | "type": "string", 16 | "analyzer": "standard_lowercase_asciifolding" 17 | }, 18 | "path_match": "participantA1.*" 19 | } 20 | } 21 | ] 22 | } 23 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/resources/mappings/test-field-analyzed-mappings.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "string", 3 | "analyzer": "standard_lowercase_asciifolding" 4 | } 5 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/resources/mappings/test-field-mappings.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "text", 3 | "fields": { 4 | "content": { 5 | "type": "text", 6 | "term_vector":"with_positions_offsets", 7 | "store": true 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/resources/mappings/test-mappings.json: -------------------------------------------------------------------------------- 1 | { 2 | "properties": { 3 | "email": { 4 | "type": "text", 5 | "analyzer": "emailAnalyzer" 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker: -------------------------------------------------------------------------------- 1 | mock-maker-inline -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/resources/node-client-configuration.yml: -------------------------------------------------------------------------------- 1 | #enabled scripts - this require groovy 2 | #script.inline: true 3 | #node.max_local_storage_nodes: 100 -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/resources/org/springframework/data/elasticsearch/client/aggregate-ok-multiple-results.json: -------------------------------------------------------------------------------- 1 | { 2 | "took": 52, 3 | "timed_out": false, 4 | "_shards": { 5 | "total": 5, 6 | "successful": 5, 7 | "skipped": 0, 8 | "failed": 0 9 | }, 10 | "hits": { 11 | "total": 0, 12 | "max_score": null, 13 | "hits": [ ] 14 | }, 15 | "aggregations": { 16 | "sterms#users": { 17 | "doc_count_error_upper_bound": 0, 18 | "sum_other_doc_count": 0, 19 | "buckets": [ 20 | { 21 | "key": "kimchy", 22 | "doc_count": 2 23 | }, 24 | { 25 | "key": "elastic", 26 | "doc_count": 1 27 | } 28 | ] 29 | }, 30 | "max#max_post_date": { 31 | "value" : 1.263519998E12, 32 | "value_as_string" : "2010-01-15T01:46:38.000Z" 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/resources/org/springframework/data/elasticsearch/client/aggregate-ok-no-results.json: -------------------------------------------------------------------------------- 1 | { 2 | "took" : 226, 3 | "timed_out" : false, 4 | "_shards" : { 5 | "total" : 5, 6 | "successful" : 5, 7 | "skipped" : 0, 8 | "failed" : 0 9 | }, 10 | "hits" : { 11 | "total" : 0, 12 | "max_score" : null, 13 | "hits" : [ ] 14 | }, 15 | "aggregations" : { 16 | "sterms#users" : { 17 | "doc_count_error_upper_bound" : 0, 18 | "sum_other_doc_count" : 0, 19 | "buckets" : [ ] 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/resources/org/springframework/data/elasticsearch/client/aggregate-ok-single-result.json: -------------------------------------------------------------------------------- 1 | { 2 | "took": 52, 3 | "timed_out": false, 4 | "_shards": { 5 | "total": 5, 6 | "successful": 5, 7 | "skipped": 0, 8 | "failed": 0 9 | }, 10 | "hits": { 11 | "total": 0, 12 | "max_score": null, 13 | "hits": [ ] 14 | }, 15 | "aggregations": { 16 | "sterms#users": { 17 | "doc_count_error_upper_bound": 0, 18 | "sum_other_doc_count": 0, 19 | "buckets": [ 20 | { 21 | "key": "kimchy", 22 | "doc_count": 2 23 | }, 24 | { 25 | "key": "elastic", 26 | "doc_count": 1 27 | } 28 | ] 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/resources/org/springframework/data/elasticsearch/client/bulk-ok.json: -------------------------------------------------------------------------------- 1 | { 2 | "took": 30, 3 | "errors": false, 4 | "items": [ 5 | { 6 | "update": { 7 | "_index": "twitter", 8 | "_type": "doc", 9 | "_id": "1", 10 | "_version": 2, 11 | "result": "updated", 12 | "_shards": { 13 | "total": 2, 14 | "successful": 1, 15 | "failed": 0 16 | }, 17 | "_seq_no": 2, 18 | "_primary_term": 4 19 | } 20 | } 21 | ] 22 | 23 | } -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/resources/org/springframework/data/elasticsearch/client/get-by-id-no-hit.json: -------------------------------------------------------------------------------- 1 | { 2 | "_index" : "twitter", 3 | "_type" : "doc", 4 | "_id" : "5", 5 | "found" : false 6 | } -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/resources/org/springframework/data/elasticsearch/client/get-by-id-ok.json: -------------------------------------------------------------------------------- 1 | { 2 | "_index" : "twitter", 3 | "_type" : "doc", 4 | "_id" : "1", 5 | "_version" : 1, 6 | "found" : true, 7 | "_source" : { 8 | "user" : "kimchy", 9 | "post_date" : "2009-11-15T13:12:00", 10 | "message" : "Trying out Elasticsearch, so far so good?" 11 | } 12 | } -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/resources/org/springframework/data/elasticsearch/client/index-ok-created.json: -------------------------------------------------------------------------------- 1 | { 2 | "_index": "twitter", 3 | "_type": "doc", 4 | "_id": "10", 5 | "_version": 1, 6 | "result": "created", 7 | "_shards": { 8 | "total": 2, 9 | "successful": 1, 10 | "failed": 0 11 | }, 12 | "_seq_no": 0, 13 | "_primary_term": 1 14 | } 15 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/resources/org/springframework/data/elasticsearch/client/index-ok-updated.json: -------------------------------------------------------------------------------- 1 | { 2 | "_index" : "twitter", 3 | "_type" : "doc", 4 | "_id" : "1", 5 | "_version" : 2, 6 | "result" : "updated", 7 | "_shards" : { 8 | "total" : 2, 9 | "successful" : 1, 10 | "failed" : 0 11 | }, 12 | "_seq_no" : 1, 13 | "_primary_term" : 1 14 | } -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/resources/org/springframework/data/elasticsearch/client/info.json: -------------------------------------------------------------------------------- 1 | { 2 | "cluster_name": "elasticsearch", 3 | "cluster_uuid": "r1tpSEemQZiSVJbfAqOLjg", 4 | "name": "T14BIoj", 5 | "tagline": "You Know, for Search", 6 | "version": { 7 | "build_date": "2018-08-17T23:18:47.308994Z", 8 | "build_flavor": "default", 9 | "build_hash": "595516e", 10 | "build_snapshot": false, 11 | "build_type": "tar", 12 | "lucene_version": "7.4.0", 13 | "minimum_index_compatibility_version": "5.0.0", 14 | "minimum_wire_compatibility_version": "5.6.0", 15 | "number": "6.4.0" 16 | } 17 | } -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/resources/org/springframework/data/elasticsearch/client/multi-get-ok-2-hits-1-unavailable.json: -------------------------------------------------------------------------------- 1 | { 2 | "docs": [ 3 | { 4 | "_index": "twitter", 5 | "_type": "doc", 6 | "_id": "1", 7 | "_version": 1, 8 | "found": true, 9 | "_source": { 10 | "user": "kimchy", 11 | "post_date": "2009-11-15T13:12:00", 12 | "message": "Trying out Elasticsearch, so far so good?" 13 | } 14 | }, 15 | { 16 | "_index": "twitter", 17 | "_type": "_doc", 18 | "_id": "2", 19 | "found": false 20 | }, 21 | { 22 | "_index": "twitter", 23 | "_type": "doc", 24 | "_id": "3", 25 | "_version": 1, 26 | "found": true, 27 | "_source": { 28 | "user": "elastic", 29 | "post_date": "2010-01-15T01:46:38", 30 | "message": "Building the site, should be kewl" 31 | } 32 | } 33 | ] 34 | } -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/resources/org/springframework/data/elasticsearch/client/multi-get-ok-2-hits.json: -------------------------------------------------------------------------------- 1 | { 2 | "docs": [ 3 | { 4 | "_index": "twitter", 5 | "_type": "doc", 6 | "_id": "1", 7 | "_version": 1, 8 | "found": true, 9 | "_source": { 10 | "user": "kimchy", 11 | "post_date": "2009-11-15T13:12:00", 12 | "message": "Trying out Elasticsearch, so far so good?" 13 | } 14 | }, 15 | { 16 | "_index": "twitter", 17 | "_type": "doc", 18 | "_id": "2", 19 | "_version": 1, 20 | "found": true, 21 | "_source": { 22 | "user": "kimchy", 23 | "post_date": "2009-11-15T14:12:12", 24 | "message": "Another tweet, will it be indexed?" 25 | } 26 | } 27 | ] 28 | } -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/resources/org/springframework/data/elasticsearch/client/scroll_clean.json: -------------------------------------------------------------------------------- 1 | { 2 | "num_freed": 1, 3 | "succeeded": true 4 | } 5 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/resources/org/springframework/data/elasticsearch/client/scroll_no_more_results.json: -------------------------------------------------------------------------------- 1 | { 2 | "_shards": { 3 | "failed": 0, 4 | "skipped": 0, 5 | "successful": 5, 6 | "total": 5 7 | }, 8 | "hits": { 9 | "hits": [], 10 | "max_score": 1.0, 11 | "total": 100 12 | }, 13 | "terminated_early": true, 14 | "timed_out": false, 15 | "took": 1 16 | } 17 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/resources/org/springframework/data/elasticsearch/client/scroll_ok.json: -------------------------------------------------------------------------------- 1 | { 2 | "_shards": { 3 | "failed": 0, 4 | "skipped": 0, 5 | "successful": 5, 6 | "total": 5 7 | }, 8 | "hits": { 9 | "hits": [ 10 | { 11 | "_index": "twitter", 12 | "_type": "doc", 13 | "_id": "2", 14 | "_score": 0.2876821, 15 | "_source": { 16 | "user": "kimchy", 17 | "post_date": "2009-11-15T14:12:12", 18 | "message": "Another tweet, will it be indexed?" 19 | } 20 | }, 21 | { 22 | "_index": "twitter", 23 | "_type": "doc", 24 | "_id": "1", 25 | "_score": 0.2876821, 26 | "_source": { 27 | "user": "kimchy", 28 | "post_date": "2009-11-15T13:12:00", 29 | "message": "Trying out Elasticsearch, so far so good?" 30 | } 31 | } 32 | ], 33 | "max_score": 1.0, 34 | "total": 100 35 | }, 36 | "terminated_early": true, 37 | "timed_out": false, 38 | "took": 1 39 | } 40 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/resources/org/springframework/data/elasticsearch/client/search-ok-multiple-hits.json: -------------------------------------------------------------------------------- 1 | { 2 | "took" : 52, 3 | "timed_out" : false, 4 | "_shards" : { 5 | "total" : 5, 6 | "successful" : 5, 7 | "skipped" : 0, 8 | "failed" : 0 9 | }, 10 | "hits" : { 11 | "total" : 2, 12 | "max_score" : 0.2876821, 13 | "hits" : [ 14 | { 15 | "_index" : "twitter", 16 | "_type" : "doc", 17 | "_id" : "2", 18 | "_score" : 0.2876821, 19 | "_source" : { 20 | "user" : "kimchy", 21 | "post_date" : "2009-11-15T14:12:12", 22 | "message" : "Another tweet, will it be indexed?" 23 | } 24 | }, 25 | { 26 | "_index" : "twitter", 27 | "_type" : "doc", 28 | "_id" : "1", 29 | "_score" : 0.2876821, 30 | "_source" : { 31 | "user" : "kimchy", 32 | "post_date" : "2009-11-15T13:12:00", 33 | "message" : "Trying out Elasticsearch, so far so good?" 34 | } 35 | } 36 | ] 37 | } 38 | } -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/resources/org/springframework/data/elasticsearch/client/search-ok-no-hits.json: -------------------------------------------------------------------------------- 1 | { 2 | "took" : 226, 3 | "timed_out" : false, 4 | "_shards" : { 5 | "total" : 5, 6 | "successful" : 5, 7 | "skipped" : 0, 8 | "failed" : 0 9 | }, 10 | "hits" : { 11 | "total" : 0, 12 | "max_score" : null, 13 | "hits" : [ ] 14 | } 15 | } -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/resources/org/springframework/data/elasticsearch/client/search-ok-scroll.json: -------------------------------------------------------------------------------- 1 | { 2 | "took": 52, 3 | "timed_out": false, 4 | "_scroll_id": "DnF1ZXJ5VGhlbkZldGNoBQAAAAAAAAAHFndhSE1uNUlLUXhXb1ZvQTNqOHNrMWcAAAAAAAAABhZ3YUhNbjVJS1F4V29Wb0EzajhzazFnAAAAAAAAAAgWd2FITW41SUtReFdvVm9BM2o4c2sxZwAAAAAAAAAJFndhSE1uNUlLUXhXb1ZvQTNqOHNrMWcAAAAAAAAAChZ3YUhNbjVJS1F4V29Wb0EzajhzazFn", 5 | "_shards": { 6 | "total": 5, 7 | "successful": 5, 8 | "skipped": 0, 9 | "failed": 0 10 | }, 11 | "hits": { 12 | "total": 100, 13 | "max_score": 0.2876821, 14 | "hits": [ 15 | { 16 | "_index": "twitter", 17 | "_type": "doc", 18 | "_id": "2", 19 | "_score": 0.2876821, 20 | "_source": { 21 | "user": "kimchy", 22 | "post_date": "2009-11-15T14:12:12", 23 | "message": "Another tweet, will it be indexed?" 24 | } 25 | }, 26 | { 27 | "_index": "twitter", 28 | "_type": "doc", 29 | "_id": "1", 30 | "_score": 0.2876821, 31 | "_source": { 32 | "user": "kimchy", 33 | "post_date": "2009-11-15T13:12:00", 34 | "message": "Trying out Elasticsearch, so far so good?" 35 | } 36 | } 37 | ] 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/resources/org/springframework/data/elasticsearch/client/search-ok-single-hit.json: -------------------------------------------------------------------------------- 1 | { 2 | "took" : 52, 3 | "timed_out" : false, 4 | "_shards" : { 5 | "total" : 5, 6 | "successful" : 5, 7 | "skipped" : 0, 8 | "failed" : 0 9 | }, 10 | "hits" : { 11 | "total" : 1, 12 | "max_score" : 0.2876821, 13 | "hits" : [ 14 | { 15 | "_index" : "twitter", 16 | "_type" : "doc", 17 | "_id" : "2", 18 | "_score" : 0.2876821, 19 | "_source" : { 20 | "user" : "kimchy", 21 | "post_date" : "2009-11-15T14:12:12", 22 | "message" : "Another tweet, will it be indexed?" 23 | } 24 | } 25 | ] 26 | } 27 | } -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/resources/org/springframework/data/elasticsearch/client/update-error-not-found.json: -------------------------------------------------------------------------------- 1 | { 2 | "error": { 3 | "index": "twitter", 4 | "index_uuid": "C91lAFXcRR6GTpYv6QIJFQ", 5 | "reason": "[doc][101]: document missing", 6 | "root_cause": [ 7 | { 8 | "index": "twitter", 9 | "index_uuid": "C91lAFXcRR6GTpYv6QIJFQ", 10 | "reason": "[doc][101]: document missing", 11 | "shard": "1", 12 | "type": "document_missing_exception" 13 | } 14 | ], 15 | "shard": "1", 16 | "type": "document_missing_exception" 17 | }, 18 | "status": 404 19 | } -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/resources/org/springframework/data/elasticsearch/client/update-ok-deleted.json: -------------------------------------------------------------------------------- 1 | { 2 | "_id": "1", 3 | "_index": "twitter", 4 | "_primary_term": 4, 5 | "_seq_no": 2, 6 | "_shards": { 7 | "failed": 0, 8 | "successful": 1, 9 | "total": 2 10 | }, 11 | "_type": "doc", 12 | "_version": 1, 13 | "result": "deleted" 14 | } -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/resources/org/springframework/data/elasticsearch/client/update-ok-updated.json: -------------------------------------------------------------------------------- 1 | { 2 | "_index": "twitter", 3 | "_type": "doc", 4 | "_id": "1", 5 | "_version": 2, 6 | "result": "updated", 7 | "_shards": { 8 | "total": 2, 9 | "successful": 1, 10 | "failed": 0 11 | }, 12 | "_seq_no": 2, 13 | "_primary_term": 4 14 | } -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/resources/settings/test-normalizer.json: -------------------------------------------------------------------------------- 1 | { 2 | "index": { 3 | "analysis": { 4 | "normalizer": { 5 | "lower_case_normalizer": { 6 | "type": "custom", 7 | "char_filter": [], 8 | "filter": [ "lowercase" ] 9 | } 10 | } 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/resources/settings/test-settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "index": { 3 | "number_of_shards": "1", 4 | "number_of_replicas": "0", 5 | "analysis": { 6 | "analyzer": { 7 | "emailAnalyzer": { 8 | "type": "custom", 9 | "tokenizer": "uax_url_email" 10 | } 11 | } 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/resources/settings/test-settings.yml: -------------------------------------------------------------------------------- 1 | index: 2 | number_of_shards: 1 3 | number_of_replicas: 0 4 | analysis: 5 | analyzer: 6 | emailAnalyzer: 7 | type: custom 8 | tokenizer: uax_url_email -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/resources/synonyms/mappings.json: -------------------------------------------------------------------------------- 1 | { 2 | "properties": { 3 | "text": { 4 | "type": "text", 5 | "analyzer": "synonym_analyzer" 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/resources/synonyms/settings-with-external-file.json: -------------------------------------------------------------------------------- 1 | { 2 | "index": { 3 | "number_of_shards": "1", 4 | "number_of_replicas": "0", 5 | "analysis": { 6 | "analyzer": { 7 | "synonym_analyzer": { 8 | "tokenizer": "whitespace", 9 | "filter": [ 10 | "synonym_filter" 11 | ] 12 | } 13 | }, 14 | "filter": { 15 | "synonym_filter": { 16 | "type": "synonym", 17 | "synonyms_path": "synonyms.txt", 18 | "ignore_case": "true" 19 | } 20 | } 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/resources/synonyms/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "index": { 3 | "number_of_shards": "1", 4 | "number_of_replicas": "0", 5 | "analysis": { 6 | "analyzer": { 7 | "synonym_analyzer": { 8 | "type": "custom", 9 | "tokenizer": "whitespace", 10 | "filter": [ 11 | "synonym_filter" 12 | ] 13 | } 14 | }, 15 | "filter": { 16 | "synonym_filter": { 17 | "type": "synonym", 18 | "lenient": true, 19 | "synonyms": [ 20 | "british,english", 21 | "queen,monarch" 22 | ] 23 | } 24 | } 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/resources/synonyms/synonyms.txt: -------------------------------------------------------------------------------- 1 | british,english 2 | queen,monarch 3 | 4 | -------------------------------------------------------------------------------- /spring-data-opensearch/src/test/resources/testcontainers-opensearch.properties: -------------------------------------------------------------------------------- 1 | # 2 | # properties defining the image, these are not passed to the container on startup 3 | # 4 | sde.testcontainers.image-name=opensearchproject/opensearch 5 | sde.testcontainers.image-version=${project.property('sde.testcontainers.image-version')} 6 | -------------------------------------------------------------------------------- /version.properties: -------------------------------------------------------------------------------- 1 | version=1.7.0 2 | --------------------------------------------------------------------------------