From 991e5d88330d349a51a15a9ee273fe0b9d263cd8 Mon Sep 17 00:00:00 2001 From: Dimitrios Athanasiou Date: Tue, 28 Mar 2017 17:14:47 +0100 Subject: [PATCH] [TEST] Set required euery on delete-by-query request Original commit: elastic/x-pack-elasticsearch@b9b6234f3d668384b3d0408b80a15aa848b192a5 --- .../xpack/security/ReindexWithSecurityIT.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/qa/reindex-tests-with-security/src/test/java/org/elasticsearch/xpack/security/ReindexWithSecurityIT.java b/qa/reindex-tests-with-security/src/test/java/org/elasticsearch/xpack/security/ReindexWithSecurityIT.java index c09fe2bb9b9..63e16219774 100644 --- a/qa/reindex-tests-with-security/src/test/java/org/elasticsearch/xpack/security/ReindexWithSecurityIT.java +++ b/qa/reindex-tests-with-security/src/test/java/org/elasticsearch/xpack/security/ReindexWithSecurityIT.java @@ -9,6 +9,7 @@ import org.elasticsearch.action.bulk.byscroll.BulkByScrollResponse; import org.elasticsearch.common.network.NetworkModule; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.IndexNotFoundException; +import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.index.reindex.DeleteByQueryAction; import org.elasticsearch.index.reindex.ReindexAction; import org.elasticsearch.index.reindex.ReindexPlugin; @@ -48,14 +49,23 @@ public class ReindexWithSecurityIT extends SecurityIntegTestCase { public void testDeleteByQuery() { createIndicesWithRandomAliases("test1", "test2", "test3"); - BulkByScrollResponse response = DeleteByQueryAction.INSTANCE.newRequestBuilder(client()).source("test1", "test2").get(); + BulkByScrollResponse response = DeleteByQueryAction.INSTANCE.newRequestBuilder(client()) + .source("test1", "test2") + .filter(QueryBuilders.matchAllQuery()) + .get(); assertNotNull(response); - response = DeleteByQueryAction.INSTANCE.newRequestBuilder(client()).source("test*").get(); + response = DeleteByQueryAction.INSTANCE.newRequestBuilder(client()) + .source("test*") + .filter(QueryBuilders.matchAllQuery()) + .get(); assertNotNull(response); IndexNotFoundException e = expectThrows(IndexNotFoundException.class, - () -> DeleteByQueryAction.INSTANCE.newRequestBuilder(client()).source("test1", "index1").get()); + () -> DeleteByQueryAction.INSTANCE.newRequestBuilder(client()) + .source("test1", "index1") + .filter(QueryBuilders.matchAllQuery()) + .get()); assertEquals("no such index", e.getMessage()); }