-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Compatibility issue with /_mget: RHLC 2.x connected to OpenSearch Clu…
…ster 1.x (#4812) (#4879) Signed-off-by: Andriy Redko <[email protected]> Signed-off-by: Andriy Redko <[email protected]> (cherry picked from commit d85f8cd) Signed-off-by: Andriy Redko <[email protected]> Signed-off-by: Andriy Redko <[email protected]>
- Loading branch information
Showing
5 changed files
with
71 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,6 +43,7 @@ BWC_VERSION: | |
- "1.3.4" | ||
- "1.3.5" | ||
- "1.3.6" | ||
- "1.3.7" | ||
- "1.4.0" | ||
- "2.0.0" | ||
- "2.0.1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
qa/mixed-cluster/src/test/java/org/opensearch/backwards/SearchingIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
package org.opensearch.backwards; | ||
|
||
import org.apache.http.HttpHost; | ||
import org.opensearch.action.get.MultiGetRequest; | ||
import org.opensearch.action.get.MultiGetResponse; | ||
import org.opensearch.client.Request; | ||
import org.opensearch.client.RequestOptions; | ||
import org.opensearch.client.Response; | ||
import org.opensearch.client.RestClient; | ||
import org.opensearch.client.RestHighLevelClient; | ||
import org.opensearch.test.rest.OpenSearchRestTestCase; | ||
import org.opensearch.test.rest.yaml.ObjectPath; | ||
|
||
import java.io.IOException; | ||
import java.net.URISyntaxException; | ||
import java.util.HashSet; | ||
import java.util.Map; | ||
import java.util.Set; | ||
|
||
import static org.hamcrest.Matchers.containsString; | ||
|
||
public class SearchingIT extends OpenSearchRestTestCase { | ||
public void testMultiGet() throws Exception { | ||
final Set<HttpHost> nodes = buildNodes(); | ||
|
||
final MultiGetRequest multiGetRequest = new MultiGetRequest(); | ||
multiGetRequest.add("index", "id1"); | ||
|
||
try (RestHighLevelClient client = new RestHighLevelClient(RestClient.builder(nodes.toArray(HttpHost[]::new)))) { | ||
MultiGetResponse response = client.mget(multiGetRequest, RequestOptions.DEFAULT); | ||
assertEquals(1, response.getResponses().length); | ||
|
||
assertTrue(response.getResponses()[0].isFailed()); | ||
assertNotNull(response.getResponses()[0].getFailure()); | ||
assertEquals(response.getResponses()[0].getFailure().getId(), "id1"); | ||
assertEquals(response.getResponses()[0].getFailure().getIndex(), "index"); | ||
assertThat(response.getResponses()[0].getFailure().getMessage(), containsString("no such index [index]")); | ||
} | ||
} | ||
|
||
private Set<HttpHost> buildNodes() throws IOException, URISyntaxException { | ||
Response response = client().performRequest(new Request("GET", "_nodes")); | ||
ObjectPath objectPath = ObjectPath.createFromResponse(response); | ||
Map<String, Object> nodesAsMap = objectPath.evaluate("nodes"); | ||
final Set<HttpHost> nodes = new HashSet<>(); | ||
for (String id : nodesAsMap.keySet()) { | ||
nodes.add(HttpHost.create((String) objectPath.evaluate("nodes." + id + ".http.publish_address"))); | ||
} | ||
|
||
return nodes; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters