diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b0a4c757..1f9e3235 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -30,10 +30,10 @@ jobs: - name: Checkout Branch uses: actions/checkout@v2 - name: Build with Gradle - run: ./gradlew build -Dopensearch.version=2.0.0-SNAPSHOT + run: ./gradlew build -Dopensearch.version=2.0.0-alpha1-SNAPSHOT - name: Pull and Run Docker for security tests run: | - version=2.0.0-SNAPSHOT + version=2.0.0-alpha1-SNAPSHOT plugin_version=2.0.0.0-SNAPSHOT pwd=`pwd` echo $pwd @@ -108,7 +108,7 @@ jobs: - name: Checkout Branch uses: actions/checkout@v2 - name: Build with Gradle - run: ./gradlew.bat build -D"opensearch.version=2.0.0-SNAPSHOT" -x integTest -x jacocoTestReport + run: ./gradlew.bat build -D"opensearch.version=2.0.0-alpha1-SNAPSHOT" -x integTest -x jacocoTestReport env: _JAVA_OPTIONS: -Xmx4096M - name: Create Artifact Path @@ -136,7 +136,7 @@ jobs: - name: Checkout Branch uses: actions/checkout@v2 - name: Build with Gradle - run: ./gradlew build -Dopensearch.version=2.0.0-SNAPSHOT -x integTest -x jacocoTestReport + run: ./gradlew build -Dopensearch.version=2.0.0-alpha1-SNAPSHOT -x integTest -x jacocoTestReport env: _JAVA_OPTIONS: -Xmx4096M - name: Create Artifact Path diff --git a/.github/workflows/multi-node-test-workflow.yml b/.github/workflows/multi-node-test-workflow.yml index 5910fcfa..797c6f2a 100644 --- a/.github/workflows/multi-node-test-workflow.yml +++ b/.github/workflows/multi-node-test-workflow.yml @@ -27,7 +27,7 @@ jobs: - name: Checkout Branch uses: actions/checkout@v2 - name: Run integration tests with multi node config - run: ./gradlew integTest -PnumNodes=5 -Dopensearch.version=2.0.0-SNAPSHOT + run: ./gradlew integTest -PnumNodes=5 -Dopensearch.version=2.0.0-alpha1-SNAPSHOT - name: Run Backwards Compatibility Tests run: | echo "Running backwards compatibility tests ..." diff --git a/build.gradle b/build.gradle index b6c3d5bc..2b3825d3 100644 --- a/build.gradle +++ b/build.gradle @@ -10,12 +10,19 @@ buildscript { distribution = 'oss-zip' opensearch_group = "org.opensearch" isSnapshot = "true" == System.getProperty("build.snapshot", "true") - opensearch_version = System.getProperty("opensearch.version", "2.0.0-SNAPSHOT") - // 1.0.0 -> 1.0.0.0, and 1.0.0-SNAPSHOT -> 1.0.0.0-SNAPSHOT + opensearch_version = System.getProperty("opensearch.version", "2.0.0-alpha1-SNAPSHOT") opendistro_plugin_version = System.getProperty("bwc.version", "1.13.0.1") - opensearch_build = opensearch_version.replaceAll(/(\.\d)([^\d]*)$/, '$1.0$2') - common_utils_version = System.getProperty("common_utils.version", opensearch_build) buildVersionQualifier = System.getProperty("build.version_qualifier") + // 2.0.0-alpha1-SNAPSHOT -> 2.0.0.0-alpha1-SNAPSHOT + version_tokens = opensearch_version.tokenize('-') + opensearch_build = version_tokens[0] + '.0' + if (buildVersionQualifier) { + opensearch_build += "-${buildVersionQualifier}" + } + if (isSnapshot) { + opensearch_build += "-SNAPSHOT" + } + common_utils_version = System.getProperty("common_utils.version", opensearch_build) } repositories { @@ -78,13 +85,7 @@ targetCompatibility = JavaVersion.VERSION_11 allprojects { group 'org.opensearch' - version = opensearch_version.tokenize('-')[0] + '.0' - if (buildVersionQualifier) { - version += "-${buildVersionQualifier}" - } - if (isSnapshot) { - version += "-SNAPSHOT" - } + version = opensearch_build } dependencies { diff --git a/src/main/java/org/opensearch/search/asynchronous/service/AsynchronousSearchPersistenceService.java b/src/main/java/org/opensearch/search/asynchronous/service/AsynchronousSearchPersistenceService.java index 54cf2825..60f55e02 100644 --- a/src/main/java/org/opensearch/search/asynchronous/service/AsynchronousSearchPersistenceService.java +++ b/src/main/java/org/opensearch/search/asynchronous/service/AsynchronousSearchPersistenceService.java @@ -67,7 +67,6 @@ public class AsynchronousSearchPersistenceService { private static final Logger logger = LogManager.getLogger(AsynchronousSearchPersistenceService.class); public static final String ASYNC_SEARCH_RESPONSE_INDEX = ".opendistro-asynchronous-search-response"; - private static final String MAPPING_TYPE = "_doc"; /** * The backoff policy to use when saving a asynchronous search response fails. The total wait * time is 600000 milliseconds, ten minutes. @@ -327,7 +326,7 @@ public void deleteExpiredResponses(ActionListener listener private void createIndexAndDoStoreResult(String id, AsynchronousSearchPersistenceModel persistenceModel, ActionListener listener) { - client.admin().indices().prepareCreate(ASYNC_SEARCH_RESPONSE_INDEX).addMapping(MAPPING_TYPE, mapping()) + client.admin().indices().prepareCreate(ASYNC_SEARCH_RESPONSE_INDEX).setMapping(mapping()) .setSettings(indexSettings()).execute(ActionListener.wrap(createIndexResponse -> doStoreResult(id, persistenceModel, listener), exception -> { if (ExceptionsHelper.unwrapCause(exception) instanceof ResourceAlreadyExistsException) { diff --git a/src/test/java/org/opensearch/search/asynchronous/integTests/AsynchronousSearchQueryIT.java b/src/test/java/org/opensearch/search/asynchronous/integTests/AsynchronousSearchQueryIT.java index 5b6127f6..dda7fba5 100644 --- a/src/test/java/org/opensearch/search/asynchronous/integTests/AsynchronousSearchQueryIT.java +++ b/src/test/java/org/opensearch/search/asynchronous/integTests/AsynchronousSearchQueryIT.java @@ -11,12 +11,12 @@ package org.opensearch.search.asynchronous.integTests; +import org.apache.lucene.tests.analysis.MockTokenizer; import org.opensearch.search.asynchronous.plugin.AsynchronousSearchPlugin; import org.opensearch.search.asynchronous.request.GetAsynchronousSearchRequest; import org.opensearch.search.asynchronous.request.SubmitAsynchronousSearchRequest; import org.opensearch.search.asynchronous.response.AsynchronousSearchResponse; import org.opensearch.search.asynchronous.utils.TestClientUtils; -import org.apache.lucene.analysis.MockTokenizer; import org.apache.lucene.analysis.pattern.PatternReplaceCharFilter; import org.opensearch.action.admin.indices.refresh.RefreshRequest; import org.opensearch.action.search.SearchRequest; @@ -120,14 +120,13 @@ public void testAggregationQuery() throws InterruptedException, ExecutionExcepti // statement assertAcked(prepareCreate("test") .setSettings(Settings.builder().put(SETTING_NUMBER_OF_SHARDS, NUM_SHARDS).put(SETTING_NUMBER_OF_REPLICAS, 0)) - .addMapping( - "book", "author", "type=keyword", "name", "type=text", "genre", - "type=keyword", "price", "type=float")); + .setMapping( + "author", "type=keyword", "name", "type=text", "genre", "type=keyword", "price", "type=float")); createIndex("idx_unmapped"); // idx_unmapped_author is same as main index but missing author field assertAcked(prepareCreate("idx_unmapped_author") .setSettings(Settings.builder().put(SETTING_NUMBER_OF_SHARDS, NUM_SHARDS).put(SETTING_NUMBER_OF_REPLICAS, 0)) - .addMapping("book", "name", "type=text", "genre", "type=keyword", "price", "type=float")); + .setMapping("name", "type=text", "genre", "type=keyword", "price", "type=float")); ensureGreen(); String data[] = { @@ -184,7 +183,7 @@ public void testAggregationQuery() throws InterruptedException, ExecutionExcepti public void testIpRangeQuery() throws InterruptedException { assertAcked(prepareCreate("idx") - .addMapping("type", "ip", "type=ip", "ips", "type=ip")); + .setMapping("ip", "type=ip", "ips", "type=ip")); waitForRelocation(ClusterHealthStatus.GREEN); indexRandom(true, @@ -235,17 +234,15 @@ public void testIpRangeQuery() throws InterruptedException { public void testHighlighterQuery() throws IOException, InterruptedException { XContentBuilder mappings = jsonBuilder(); - mappings.startObject(); - mappings.startObject("type") + mappings.startObject() .startObject("properties") .startObject("text") .field("type", "keyword") .field("store", true) .endObject() .endObject().endObject(); - mappings.endObject(); assertAcked(prepareCreate("test1") - .addMapping("type", mappings)); + .setMapping(mappings)); client().prepareIndex("test1").setId("1") .setSource(jsonBuilder().startObject().field("text", "foo").endObject()) .get(); diff --git a/src/test/java/org/opensearch/search/asynchronous/listener/AsynchronousSearchPartialResponseIT.java b/src/test/java/org/opensearch/search/asynchronous/listener/AsynchronousSearchPartialResponseIT.java index 0e022ab0..aa91b909 100644 --- a/src/test/java/org/opensearch/search/asynchronous/listener/AsynchronousSearchPartialResponseIT.java +++ b/src/test/java/org/opensearch/search/asynchronous/listener/AsynchronousSearchPartialResponseIT.java @@ -63,7 +63,7 @@ protected int numberOfShards() { protected void createIdx(String keyFieldMapping) { assertAcked(prepareCreate("idx") - .addMapping("type", "key", keyFieldMapping)); + .setMapping("key", keyFieldMapping)); } protected void indexData() throws Exception { diff --git a/src/test/java/org/opensearch/search/asynchronous/management/AsynchronousSearchManagementServiceIT.java b/src/test/java/org/opensearch/search/asynchronous/management/AsynchronousSearchManagementServiceIT.java index 62ca8922..d8c34b63 100644 --- a/src/test/java/org/opensearch/search/asynchronous/management/AsynchronousSearchManagementServiceIT.java +++ b/src/test/java/org/opensearch/search/asynchronous/management/AsynchronousSearchManagementServiceIT.java @@ -124,7 +124,7 @@ public void testCleansUpExpiredAsynchronousSearchDuringFetchPhase() throws Excep public void testDeletesExpiredAsynchronousSearchResponseFromPersistedStore() throws Exception { String idx = "idx"; assertAcked(prepareCreate(idx) - .addMapping("type", "ip", "type=ip", "ips", "type=ip")); + .setMapping("ip", "type=ip", "ips", "type=ip")); waitForRelocation(ClusterHealthStatus.GREEN); indexRandom(true, client().prepareIndex(idx).setId("1").setSource( diff --git a/src/test/java/org/opensearch/search/asynchronous/request/AsynchronousSearchRequestRoutingIT.java b/src/test/java/org/opensearch/search/asynchronous/request/AsynchronousSearchRequestRoutingIT.java index f4096245..7c152d0f 100644 --- a/src/test/java/org/opensearch/search/asynchronous/request/AsynchronousSearchRequestRoutingIT.java +++ b/src/test/java/org/opensearch/search/asynchronous/request/AsynchronousSearchRequestRoutingIT.java @@ -48,7 +48,7 @@ protected int maximumNumberOfReplicas() { public void testRequestForwardingToCoordinatorNodeForPersistedAsynchronousSearch() throws Exception { String idx = "idx"; assertAcked(prepareCreate(idx) - .addMapping("type", "ip", "type=ip", "ips", "type=ip")); + .setMapping("ip", "type=ip", "ips", "type=ip")); waitForRelocation(ClusterHealthStatus.GREEN); indexRandom(true, client().prepareIndex(idx).setId("1").setSource( @@ -98,7 +98,7 @@ public void testRequestForwardingToCoordinatorNodeForRunningAsynchronousSearch() List plugins = initBlockFactory(); String index = "idx"; assertAcked(prepareCreate(index) - .addMapping("type", "ip", "type=ip", "ips", "type=ip")); + .setMapping("ip", "type=ip", "ips", "type=ip")); waitForRelocation(ClusterHealthStatus.GREEN); indexRandom(true,