Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into node-role-cluster-m…
Browse files Browse the repository at this point in the history
…anager

Signed-off-by: Tianli Feng <ftianli@amazon.com>
  • Loading branch information
Tianli Feng committed Mar 18, 2022
2 parents 87e5048 + 9f83dea commit f57741d
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 182 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -397,14 +397,14 @@ public void testPercolatorQueryExistingDocument() throws Exception {

logger.info("percolating empty doc");
SearchResponse response = client().prepareSearch()
.setQuery(new PercolateQueryBuilder("query", "test", "type", "1", null, null, null))
.setQuery(new PercolateQueryBuilder("query", "test", "1", null, null, null))
.get();
assertHitCount(response, 1);
assertThat(response.getHits().getAt(0).getId(), equalTo("1"));

logger.info("percolating doc with 1 field");
response = client().prepareSearch()
.setQuery(new PercolateQueryBuilder("query", "test", "type", "5", null, null, null))
.setQuery(new PercolateQueryBuilder("query", "test", "5", null, null, null))
.addSort("id", SortOrder.ASC)
.get();
assertHitCount(response, 2);
Expand All @@ -413,7 +413,7 @@ public void testPercolatorQueryExistingDocument() throws Exception {

logger.info("percolating doc with 2 fields");
response = client().prepareSearch()
.setQuery(new PercolateQueryBuilder("query", "test", "type", "6", null, null, null))
.setQuery(new PercolateQueryBuilder("query", "test", "6", null, null, null))
.addSort("id", SortOrder.ASC)
.get();
assertHitCount(response, 3);
Expand All @@ -438,7 +438,7 @@ public void testPercolatorQueryExistingDocumentSourceDisabled() throws Exception
logger.info("percolating empty doc with source disabled");
IllegalArgumentException e = expectThrows(
IllegalArgumentException.class,
() -> { client().prepareSearch().setQuery(new PercolateQueryBuilder("query", "test", "type", "1", null, null, null)).get(); }
() -> { client().prepareSearch().setQuery(new PercolateQueryBuilder("query", "test", "1", null, null, null)).get(); }
);
assertThat(e.getMessage(), containsString("source disabled"));
}
Expand Down Expand Up @@ -1193,10 +1193,10 @@ public void testPercolatorQueryViaMultiSearch() throws Exception {
)
)
)
.add(client().prepareSearch("test").setQuery(new PercolateQueryBuilder("query", "test", "type", "5", null, null, null)))
.add(client().prepareSearch("test").setQuery(new PercolateQueryBuilder("query", "test", "5", null, null, null)))
.add(
client().prepareSearch("test") // non existing doc, so error element
.setQuery(new PercolateQueryBuilder("query", "test", "type", "6", null, null, null))
.setQuery(new PercolateQueryBuilder("query", "test", "6", null, null, null))
)
.get();

Expand Down Expand Up @@ -1228,7 +1228,7 @@ public void testPercolatorQueryViaMultiSearch() throws Exception {
item = response.getResponses()[5];
assertThat(item.getResponse(), nullValue());
assertThat(item.getFailureMessage(), notNullValue());
assertThat(item.getFailureMessage(), containsString("[test/type/6] couldn't be found"));
assertThat(item.getFailureMessage(), containsString("[test/6] couldn't be found"));
}

public void testDisallowExpensiveQueries() throws IOException {
Expand Down
Loading

0 comments on commit f57741d

Please sign in to comment.