From da65493965bc49cb10ddf6ae3bf69784be6c1a10 Mon Sep 17 00:00:00 2001 From: David Pilato Date: Thu, 13 Aug 2015 12:47:22 +0200 Subject: [PATCH 1/4] [qa] multinode tests fails when you run low on disk space (85%) Indeed, we check within the test suite that we have not unassigned shards. But when the test starts on my machine I get: ``` [elasticsearch] [2015-08-13 12:03:18,801][INFO ][org.elasticsearch.cluster.routing.allocation.decider] [Kehl of Tauran] low disk watermark [85%] exceeded on [eLujVjWAQ8OHdhscmaf0AQ][Jackhammer] free: 59.8gb[12.8%], replicas will not be assigned to this node ``` ``` 2> REPRODUCE WITH: mvn verify -Pdev -Dskip.unit.tests -Dtests.seed=2AE3A3B7B13CE3D6 -Dtests.class=org.elasticsearch.smoketest.SmokeTestMultiIT -Dtests.method="test {yaml=smoke_test_multinode/10_basic/cluster health basic test, one index}" -Des.logger.level=ERROR -Dtests.assertion.disabled=false -Dtests.security.manager=true -Dtests.heap.size=512m -Dtests.locale=ar_YE -Dtests.timezone=Asia/Hong_Kong -Dtests.rest.suite=smoke_test_multinode FAILURE 38.5s | SmokeTestMultiIT.test {yaml=smoke_test_multinode/10_basic/cluster health basic test, one index} <<< > Throwable #1: java.lang.AssertionError: expected [2xx] status code but api [cluster.health] returned [408 Request Timeout] [{"cluster_name":"prepare_release","status":"yellow","timed_out":true,"number_of_nodes":2,"number_of_data_nodes":2,"active_primary_shards":3,"active_shards":3,"relocating_shards":0,"initializing_shards":0,"unassigned_shards":3,"delayed_unassigned_shards":0,"number_of_pending_tasks":0,"number_of_in_flight_fetch":0,"task_max_waiting_in_queue_millis":0,"active_shards_percent_as_number":50.0}] ``` We don't check anymore if we have unassigned shards and we wait for `yellow` status instead of `green`. Closes #12852. --- .../rest-api-spec/test/smoke_test_multinode/10_basic.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/qa/smoke-test-multinode/rest-api-spec/test/smoke_test_multinode/10_basic.yaml b/qa/smoke-test-multinode/rest-api-spec/test/smoke_test_multinode/10_basic.yaml index 74066ebf6b1..c6b50b6d38a 100644 --- a/qa/smoke-test-multinode/rest-api-spec/test/smoke_test_multinode/10_basic.yaml +++ b/qa/smoke-test-multinode/rest-api-spec/test/smoke_test_multinode/10_basic.yaml @@ -1,5 +1,6 @@ # Integration tests for smoke testing multi-node IT -# +# If the local machine which is running the test is low on disk space +# We can have one unassigned shard --- "cluster health basic test, one index": - do: @@ -12,7 +13,7 @@ - do: cluster.health: - wait_for_status: green + wait_for_status: yellow - is_true: cluster_name - is_false: timed_out @@ -22,5 +23,4 @@ - gt: { active_shards: 0 } - gte: { relocating_shards: 0 } - match: { initializing_shards: 0 } - - match: { unassigned_shards: 0 } - gte: { number_of_pending_tasks: 0 } From 4a3ea799ec6ebabe0b97fa5aa29b5589b3fb26bc Mon Sep 17 00:00:00 2001 From: David Pilato Date: Tue, 18 Aug 2015 14:36:12 +0200 Subject: [PATCH 2/4] [qa] multinode tests fails when you run low on disk space (85%) In #12853 we actually introduced a test regression. Now as we wait for yellow instead of green, we might have some pending tasks. This commit simplify all that and only checks the number of nodes within the cluster. --- .../rest-api-spec/test/smoke_test_multinode/10_basic.yaml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/qa/smoke-test-multinode/rest-api-spec/test/smoke_test_multinode/10_basic.yaml b/qa/smoke-test-multinode/rest-api-spec/test/smoke_test_multinode/10_basic.yaml index c6b50b6d38a..f365a61ebdf 100644 --- a/qa/smoke-test-multinode/rest-api-spec/test/smoke_test_multinode/10_basic.yaml +++ b/qa/smoke-test-multinode/rest-api-spec/test/smoke_test_multinode/10_basic.yaml @@ -19,8 +19,3 @@ - is_false: timed_out - gte: { number_of_nodes: 2 } - gte: { number_of_data_nodes: 2 } - - gt: { active_primary_shards: 0 } - - gt: { active_shards: 0 } - - gte: { relocating_shards: 0 } - - match: { initializing_shards: 0 } - - gte: { number_of_pending_tasks: 0 } From 8e93ac5d5c054b0e580059331d05b6f28b22dde0 Mon Sep 17 00:00:00 2001 From: javanna Date: Fri, 14 Aug 2015 18:13:48 +0200 Subject: [PATCH 3/4] Java api: remove execution from TermsQueryBuilder as it has no effect Also introduced ParseField for execution in TermsQueryParser so proper deprecation warnings get printed out when requested. Closes #12884 --- .../index/query/TermsQueryBuilder.java | 17 ------------- .../index/query/TermsQueryParser.java | 6 ++--- .../template/SimpleIndexTemplateIT.java | 2 +- .../search/query/SearchQueryIT.java | 24 +++++++++---------- .../migration/migrate_2_0/java.asciidoc | 4 ++++ 5 files changed, 19 insertions(+), 34 deletions(-) diff --git a/core/src/main/java/org/elasticsearch/index/query/TermsQueryBuilder.java b/core/src/main/java/org/elasticsearch/index/query/TermsQueryBuilder.java index 9ffdb0c647e..ca54eb3b3d3 100644 --- a/core/src/main/java/org/elasticsearch/index/query/TermsQueryBuilder.java +++ b/core/src/main/java/org/elasticsearch/index/query/TermsQueryBuilder.java @@ -38,8 +38,6 @@ public class TermsQueryBuilder extends QueryBuilder implements BoostableQueryBui private String queryName; - private String execution; - private float boost = -1; /** @@ -118,17 +116,6 @@ public class TermsQueryBuilder extends QueryBuilder implements BoostableQueryBui this.values = values; } - /** - * Sets the execution mode for the terms filter. Cane be either "plain", "bool" - * "and". Defaults to "plain". - * @deprecated elasticsearch now makes better decisions on its own - */ - @Deprecated - public TermsQueryBuilder execution(String execution) { - this.execution = execution; - return this; - } - /** * Sets the minimum number of matches across the provided terms. Defaults to 1. * @deprecated use [bool] query instead @@ -168,10 +155,6 @@ public class TermsQueryBuilder extends QueryBuilder implements BoostableQueryBui builder.startObject(TermsQueryParser.NAME); builder.field(name, values); - if (execution != null) { - builder.field("execution", execution); - } - if (minimumShouldMatch != null) { builder.field("minimum_should_match", minimumShouldMatch); } diff --git a/core/src/main/java/org/elasticsearch/index/query/TermsQueryParser.java b/core/src/main/java/org/elasticsearch/index/query/TermsQueryParser.java index fa643892e45..db2fed37226 100644 --- a/core/src/main/java/org/elasticsearch/index/query/TermsQueryParser.java +++ b/core/src/main/java/org/elasticsearch/index/query/TermsQueryParser.java @@ -52,11 +52,9 @@ public class TermsQueryParser implements QueryParser { public static final String NAME = "terms"; private static final ParseField MIN_SHOULD_MATCH_FIELD = new ParseField("min_match", "min_should_match").withAllDeprecated("Use [bool] query instead"); private static final ParseField DISABLE_COORD_FIELD = new ParseField("disable_coord").withAllDeprecated("Use [bool] query instead"); + private static final ParseField EXECUTION_FIELD = new ParseField("execution").withAllDeprecated("execution is deprecated and has no effect"); private Client client; - @Deprecated - public static final String EXECUTION_KEY = "execution"; - @Inject public TermsQueryParser() { } @@ -141,7 +139,7 @@ public class TermsQueryParser implements QueryParser { throw new QueryParsingException(parseContext, "[terms] query lookup element requires specifying the path"); } } else if (token.isValue()) { - if (EXECUTION_KEY.equals(currentFieldName)) { + if (parseContext.parseFieldMatcher().match(currentFieldName, EXECUTION_FIELD)) { // ignore } else if (parseContext.parseFieldMatcher().match(currentFieldName, MIN_SHOULD_MATCH_FIELD)) { if (minShouldMatch != null) { diff --git a/core/src/test/java/org/elasticsearch/indices/template/SimpleIndexTemplateIT.java b/core/src/test/java/org/elasticsearch/indices/template/SimpleIndexTemplateIT.java index 1cbe5eb56dc..b8185250761 100644 --- a/core/src/test/java/org/elasticsearch/indices/template/SimpleIndexTemplateIT.java +++ b/core/src/test/java/org/elasticsearch/indices/template/SimpleIndexTemplateIT.java @@ -344,7 +344,7 @@ public class SimpleIndexTemplateIT extends ESIntegTestCase { .addAlias(new Alias("templated_alias-{index}")) .addAlias(new Alias("filtered_alias").filter("{\"type\":{\"value\":\"type2\"}}")) .addAlias(new Alias("complex_filtered_alias") - .filter(QueryBuilders.termsQuery("_type", "typeX", "typeY", "typeZ").execution("bool"))) + .filter(QueryBuilders.termsQuery("_type", "typeX", "typeY", "typeZ"))) .get(); assertAcked(prepareCreate("test_index").addMapping("type1").addMapping("type2").addMapping("typeX").addMapping("typeY").addMapping("typeZ")); diff --git a/core/src/test/java/org/elasticsearch/search/query/SearchQueryIT.java b/core/src/test/java/org/elasticsearch/search/query/SearchQueryIT.java index bca495bf31a..07363a4f240 100644 --- a/core/src/test/java/org/elasticsearch/search/query/SearchQueryIT.java +++ b/core/src/test/java/org/elasticsearch/search/query/SearchQueryIT.java @@ -1165,7 +1165,7 @@ public class SearchQueryIT extends ESIntegTestCase { } @Test - public void testFieldDatatermsQuery() throws Exception { + public void testTermsQuery() throws Exception { assertAcked(prepareCreate("test").addMapping("type", "str", "type=string", "lng", "type=long", "dbl", "type=double")); indexRandom(true, @@ -1175,60 +1175,60 @@ public class SearchQueryIT extends ESIntegTestCase { client().prepareIndex("test", "type", "4").setSource("str", "4", "lng", 4l, "dbl", 4.0d)); SearchResponse searchResponse = client().prepareSearch("test") - .setQuery(filteredQuery(matchAllQuery(), termsQuery("str", "1", "4").execution("fielddata"))).get(); + .setQuery(filteredQuery(matchAllQuery(), termsQuery("str", "1", "4"))).get(); assertHitCount(searchResponse, 2l); assertSearchHits(searchResponse, "1", "4"); searchResponse = client().prepareSearch("test") - .setQuery(filteredQuery(matchAllQuery(), termsQuery("lng", new long[] {2, 3}).execution("fielddata"))).get(); + .setQuery(filteredQuery(matchAllQuery(), termsQuery("lng", new long[] {2, 3}))).get(); assertHitCount(searchResponse, 2l); assertSearchHits(searchResponse, "2", "3"); searchResponse = client().prepareSearch("test") - .setQuery(filteredQuery(matchAllQuery(), termsQuery("dbl", new double[]{2, 3}).execution("fielddata"))).get(); + .setQuery(filteredQuery(matchAllQuery(), termsQuery("dbl", new double[]{2, 3}))).get(); assertHitCount(searchResponse, 2l); assertSearchHits(searchResponse, "2", "3"); searchResponse = client().prepareSearch("test") - .setQuery(filteredQuery(matchAllQuery(), termsQuery("lng", new int[] {1, 3}).execution("fielddata"))).get(); + .setQuery(filteredQuery(matchAllQuery(), termsQuery("lng", new int[] {1, 3}))).get(); assertHitCount(searchResponse, 2l); assertSearchHits(searchResponse, "1", "3"); searchResponse = client().prepareSearch("test") - .setQuery(filteredQuery(matchAllQuery(), termsQuery("dbl", new float[] {2, 4}).execution("fielddata"))).get(); + .setQuery(filteredQuery(matchAllQuery(), termsQuery("dbl", new float[] {2, 4}))).get(); assertHitCount(searchResponse, 2l); assertSearchHits(searchResponse, "2", "4"); // test partial matching searchResponse = client().prepareSearch("test") - .setQuery(filteredQuery(matchAllQuery(), termsQuery("str", "2", "5").execution("fielddata"))).get(); + .setQuery(filteredQuery(matchAllQuery(), termsQuery("str", "2", "5"))).get(); assertNoFailures(searchResponse); assertHitCount(searchResponse, 1l); assertFirstHit(searchResponse, hasId("2")); searchResponse = client().prepareSearch("test") - .setQuery(filteredQuery(matchAllQuery(), termsQuery("dbl", new double[] {2, 5}).execution("fielddata"))).get(); + .setQuery(filteredQuery(matchAllQuery(), termsQuery("dbl", new double[] {2, 5}))).get(); assertNoFailures(searchResponse); assertHitCount(searchResponse, 1l); assertFirstHit(searchResponse, hasId("2")); searchResponse = client().prepareSearch("test") - .setQuery(filteredQuery(matchAllQuery(), termsQuery("lng", new long[] {2, 5}).execution("fielddata"))).get(); + .setQuery(filteredQuery(matchAllQuery(), termsQuery("lng", new long[] {2, 5}))).get(); assertNoFailures(searchResponse); assertHitCount(searchResponse, 1l); assertFirstHit(searchResponse, hasId("2")); // test valid type, but no matching terms searchResponse = client().prepareSearch("test") - .setQuery(filteredQuery(matchAllQuery(), termsQuery("str", "5", "6").execution("fielddata"))).get(); + .setQuery(filteredQuery(matchAllQuery(), termsQuery("str", "5", "6"))).get(); assertHitCount(searchResponse, 0l); searchResponse = client().prepareSearch("test") - .setQuery(filteredQuery(matchAllQuery(), termsQuery("dbl", new double[] {5, 6}).execution("fielddata"))).get(); + .setQuery(filteredQuery(matchAllQuery(), termsQuery("dbl", new double[] {5, 6}))).get(); assertHitCount(searchResponse, 0l); searchResponse = client().prepareSearch("test") - .setQuery(filteredQuery(matchAllQuery(), termsQuery("lng", new long[] {5, 6}).execution("fielddata"))).get(); + .setQuery(filteredQuery(matchAllQuery(), termsQuery("lng", new long[] {5, 6}))).get(); assertHitCount(searchResponse, 0l); } diff --git a/docs/reference/migration/migrate_2_0/java.asciidoc b/docs/reference/migration/migrate_2_0/java.asciidoc index 5f2d2f4834e..d5e9acf9a0a 100644 --- a/docs/reference/migration/migrate_2_0/java.asciidoc +++ b/docs/reference/migration/migrate_2_0/java.asciidoc @@ -74,3 +74,7 @@ The following deprecated methods have been removed: The redundant BytesQueryBuilder has been removed in favour of the WrapperQueryBuilder internally. +==== TermsQueryBuilder execution removed + +The `TermsQueryBuilder#execution` method has been removed as it has no effect, it is ignored by the + corresponding parser. From 501a1996a38a50dd5460f4a3a18ee5ea959b2331 Mon Sep 17 00:00:00 2001 From: javanna Date: Fri, 14 Aug 2015 18:46:19 +0200 Subject: [PATCH 4/4] Query DSL: remove attemped (not working) support for array in not query parser Closes #12890 --- .../java/org/elasticsearch/index/query/NotQueryParser.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/core/src/main/java/org/elasticsearch/index/query/NotQueryParser.java b/core/src/main/java/org/elasticsearch/index/query/NotQueryParser.java index 68ffe435d77..6bfe4c7843a 100644 --- a/core/src/main/java/org/elasticsearch/index/query/NotQueryParser.java +++ b/core/src/main/java/org/elasticsearch/index/query/NotQueryParser.java @@ -68,10 +68,6 @@ public class NotQueryParser implements QueryParser { // its the filter, and the name is the field query = parseContext.parseInnerFilter(currentFieldName); } - } else if (token == XContentParser.Token.START_ARRAY) { - queryFound = true; - // its the filter, and the name is the field - query = parseContext.parseInnerFilter(currentFieldName); } else if (token.isValue()) { if ("_name".equals(currentFieldName)) { queryName = parser.text();