From db541d6fbe3daecec91bb7701aacfcd284662c2a Mon Sep 17 00:00:00 2001 From: Clinton Gormley Date: Fri, 7 Aug 2015 12:03:19 +0200 Subject: [PATCH 1/5] Docs: Add warning about allow_primary to the cluster reroute docs Closes #12503 --- docs/reference/cluster/reroute.asciidoc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/reference/cluster/reroute.asciidoc b/docs/reference/cluster/reroute.asciidoc index d033aee7d67..cc4dffa612a 100644 --- a/docs/reference/cluster/reroute.asciidoc +++ b/docs/reference/cluster/reroute.asciidoc @@ -70,3 +70,8 @@ The commands supported are: allocate the shard to. It also accepts `allow_primary` flag to explicitly specify that it is allowed to explicitly allocate a primary shard (might result in data loss). + +WARNING: The `allow_primary` parameter will force a new _empty_ primary shard +to be allocated *without any data*. If a node which has a copy of the original +primary shard (including data) rejoins the cluster later on, that data will be +deleted: the old shard copy will be replaced by the new live shard copy. From c2f774ac57d8326d16b1c1d3008d8c973669076f Mon Sep 17 00:00:00 2001 From: Sylvain Zimmer Date: Thu, 6 Aug 2015 18:00:08 -0400 Subject: [PATCH 2/5] Warning in the docs for negative histogram values As requested in https://github.com/elastic/elasticsearch/issues/8082#issuecomment-127962374 --- .../aggregations/bucket/histogram-aggregation.asciidoc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/reference/aggregations/bucket/histogram-aggregation.asciidoc b/docs/reference/aggregations/bucket/histogram-aggregation.asciidoc index 77e510d8b1c..bc8a6e13ffd 100644 --- a/docs/reference/aggregations/bucket/histogram-aggregation.asciidoc +++ b/docs/reference/aggregations/bucket/histogram-aggregation.asciidoc @@ -20,6 +20,11 @@ bucket_key = value - rem From the rounding function above it can be seen that the intervals themselves **must** be integers. +WARNING: Currently, values are cast to integers before being bucketed, which +might cause negative floating-point values to fall into the wrong bucket. For +instance, `-4.5` with an interval of `2` would be cast to `-4`, and so would +end up in the `-4 <= val < -2` bucket instead of the `-6 <= val < -4` bucket. + The following snippet "buckets" the products based on their `price` by interval of `50`: [source,js] From e2cbec185b2ac8ef3c1af41c304365395601c2bb Mon Sep 17 00:00:00 2001 From: Clinton Gormley Date: Fri, 7 Aug 2015 14:27:24 +0200 Subject: [PATCH 3/5] Revert "disable license checker on windows for now, jenkins boxes have perl problems" This reverts commit 6e9d8671bc3dcec4c942c201b0092b4dc46e059d. --- distribution/pom.xml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/distribution/pom.xml b/distribution/pom.xml index 80bbc98fe6e..9a01416ba30 100644 --- a/distribution/pom.xml +++ b/distribution/pom.xml @@ -111,8 +111,7 @@ Running license check - - From b6016b6e1e79144e9f57b0a9adfa9fbaf1b2a101 Mon Sep 17 00:00:00 2001 From: Alexander Reelsen Date: Fri, 7 Aug 2015 14:23:46 +0200 Subject: [PATCH 4/5] Bats testing: Remove useless systemctl check Bats testing uncovered a useless systemctl check, that resulted in an error, because the systemctl file was uninstalled, but we hoped to check for an explicetely configured SystemExitCode. In addition we did not reload the systemctl configuration when uninstalling elasticsearch, which now is fixed as well. Closes #12682 --- distribution/src/main/packaging/scripts/postrm | 2 +- .../src/test/resources/packaging/scripts/40_rpm_package.bats | 5 ----- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/distribution/src/main/packaging/scripts/postrm b/distribution/src/main/packaging/scripts/postrm index 1b44d3a8b38..3dfc52e4474 100644 --- a/distribution/src/main/packaging/scripts/postrm +++ b/distribution/src/main/packaging/scripts/postrm @@ -68,7 +68,7 @@ fi if [ "$REMOVE_SERVICE" = "true" ]; then if command -v systemctl >/dev/null; then - systemctl --no-reload disable elasticsearch.service > /dev/null 2>&1 || true + systemctl disable elasticsearch.service > /dev/null 2>&1 || true fi if command -v chkconfig >/dev/null; then diff --git a/distribution/src/test/resources/packaging/scripts/40_rpm_package.bats b/distribution/src/test/resources/packaging/scripts/40_rpm_package.bats index 6a9007e4bbe..6d8aff66410 100644 --- a/distribution/src/test/resources/packaging/scripts/40_rpm_package.bats +++ b/distribution/src/test/resources/packaging/scripts/40_rpm_package.bats @@ -116,11 +116,6 @@ setup() { # The removal must disable the service # see prerm file if is_systemd; then - # Redhat based systemd distros usually returns exit code 1 - # OpenSUSE13 returns 0 - run systemctl status elasticsearch.service - [ "$status" -eq 1 ] || [ "$status" -eq 0 ] - run systemctl is-enabled elasticsearch.service [ "$status" -eq 1 ] fi From 56c0b46f96250c5992703748dd3c8f47019ed21d Mon Sep 17 00:00:00 2001 From: javanna Date: Fri, 7 Aug 2015 16:04:51 +0200 Subject: [PATCH 5/5] [TEST] remove duplicated tests from SearchQueryIT After merging filters and queries, tests against indices filter and indices query became exactly the same. we can remove one copy then. --- .../search/query/SearchQueryIT.java | 138 ------------------ 1 file changed, 138 deletions(-) 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 f1ed9bb8e53..bca495bf31a 100644 --- a/core/src/test/java/org/elasticsearch/search/query/SearchQueryIT.java +++ b/core/src/test/java/org/elasticsearch/search/query/SearchQueryIT.java @@ -1939,40 +1939,6 @@ public class SearchQueryIT extends ESIntegTestCase { assertFirstHit(searchResponse, hasId("1")); } - @Test - public void testIndicesFilter() throws Exception { - createIndex("index1", "index2", "index3"); - - client().prepareIndex("index1", "type1").setId("1").setSource("text", "value1").get(); - client().prepareIndex("index2", "type2").setId("2").setSource("text", "value2").get(); - client().prepareIndex("index3", "type3").setId("3").setSource("text", "value3").get(); - refresh(); - - SearchResponse searchResponse = client().prepareSearch("index1", "index2", "index3") - .setPostFilter(indicesQuery(termQuery("text", "value1"), "index1") - .noMatchQuery(termQuery("text", "value2"))).get(); - assertHitCount(searchResponse, 2l); - assertSearchHits(searchResponse, "1", "2"); - - //default no match filter is "all" - searchResponse = client().prepareSearch("index1", "index2", "index3") - .setPostFilter(indicesQuery(termQuery("text", "value1"), "index1")).get(); - assertHitCount(searchResponse, 3l); - assertSearchHits(searchResponse, "1", "2", "3"); - - searchResponse = client().prepareSearch("index1", "index2", "index3") - .setPostFilter(indicesQuery(termQuery("text", "value1"), "index1") - .noMatchQuery("all")).get(); - assertHitCount(searchResponse, 3l); - assertSearchHits(searchResponse, "1", "2", "3"); - - searchResponse = client().prepareSearch("index1", "index2", "index3") - .setPostFilter(indicesQuery(termQuery("text", "value1"), "index1") - .noMatchQuery("none")).get(); - assertHitCount(searchResponse, 1l); - assertFirstHit(searchResponse, hasId("1")); - } - @Test // https://github.com/elasticsearch/elasticsearch/issues/2416 public void testIndicesQuerySkipParsing() throws Exception { createIndex("simple"); @@ -2005,37 +1971,6 @@ public class SearchQueryIT extends ESIntegTestCase { assertSearchHits(searchResponse, "1", "2"); } - @Test // https://github.com/elasticsearch/elasticsearch/issues/2416 - public void testIndicesFilterSkipParsing() throws Exception { - createIndex("simple"); - assertAcked(prepareCreate("related") - .addMapping("child", jsonBuilder().startObject().startObject("child").startObject("_parent").field("type", "parent") - .endObject().endObject().endObject())); - - indexRandom(true, - client().prepareIndex("simple", "lone").setId("1").setSource("text", "value1"), - client().prepareIndex("related", "parent").setId("2").setSource("text", "parent"), - client().prepareIndex("related", "child").setId("3").setParent("2").setSource("text", "value2")); - - //has_child fails if executed on "simple" index - try { - client().prepareSearch("simple") - .setPostFilter(hasChildQuery("child", termQuery("text", "value1"))).get(); - fail("Should have failed as has_child query can only be executed against parent-child types"); - } catch (SearchPhaseExecutionException e) { - assertThat(e.shardFailures().length, greaterThan(0)); - for (ShardSearchFailure shardSearchFailure : e.shardFailures()) { - assertThat(shardSearchFailure.reason(), containsString("No mapping for for type [child]")); - } - } - - SearchResponse searchResponse = client().prepareSearch("related", "simple") - .setPostFilter(indicesQuery(hasChildQuery("child", termQuery("text", "value2")), "related") - .noMatchQuery(termQuery("text", "value1"))).get(); - assertHitCount(searchResponse, 2l); - assertSearchHits(searchResponse, "1", "2"); - } - @Test public void testIndicesQueryMissingIndices() throws IOException, ExecutionException, InterruptedException { createIndex("index1"); @@ -2105,79 +2040,6 @@ public class SearchQueryIT extends ESIntegTestCase { } } - @Test - public void testIndicesFilterMissingIndices() throws IOException, ExecutionException, InterruptedException { - createIndex("index1"); - createIndex("index2"); - createIndex("index3"); - - indexRandom(true, - client().prepareIndex("index1", "type1", "1").setSource("field", "match"), - client().prepareIndex("index1", "type1", "2").setSource("field", "no_match"), - client().prepareIndex("index2", "type1", "10").setSource("field", "match"), - client().prepareIndex("index2", "type1", "20").setSource("field", "no_match"), - client().prepareIndex("index3", "type1", "100").setSource("field", "match"), - client().prepareIndex("index3", "type1", "200").setSource("field", "no_match")); - - //all indices are missing - SearchResponse searchResponse = client().prepareSearch().setQuery( - filteredQuery(matchAllQuery(), - indicesQuery(termQuery("field", "missing"), "test1", "test2", "test3") - .noMatchQuery(termQuery("field", "match")))).get(); - - assertHitCount(searchResponse, 3l); - - for (SearchHit hit : searchResponse.getHits().getHits()) { - if ("index1".equals(hit.index())) { - assertThat(hit, hasId("1")); - } else if ("index2".equals(hit.index())) { - assertThat(hit, hasId("10")); - } else if ("index3".equals(hit.index())) { - assertThat(hit, hasId("100")); - } else { - fail("Returned documents should belong to either index1, index2 or index3"); - } - } - - //only one index specified, which is missing - searchResponse = client().prepareSearch().setQuery( - filteredQuery(matchAllQuery(), - indicesQuery(termQuery("field", "missing"), "test1") - .noMatchQuery(termQuery("field", "match")))).get(); - - assertHitCount(searchResponse, 3l); - - for (SearchHit hit : searchResponse.getHits().getHits()) { - if ("index1".equals(hit.index())) { - assertThat(hit, hasId("1")); - } else if ("index2".equals(hit.index())) { - assertThat(hit, hasId("10")); - } else if ("index3".equals(hit.index())) { - assertThat(hit, hasId("100")); - } else { - fail("Returned documents should belong to either index1, index2 or index3"); - } - } - - //more than one index specified, one of them is missing - searchResponse = client().prepareSearch().setQuery( - filteredQuery(matchAllQuery(), - indicesQuery(termQuery("field", "missing"), "index1", "test1") - .noMatchQuery(termQuery("field", "match")))).get(); - - assertHitCount(searchResponse, 2l); - - for (SearchHit hit : searchResponse.getHits().getHits()) { - if ("index2".equals(hit.index())) { - assertThat(hit, hasId("10")); - } else if ("index3".equals(hit.index())) { - assertThat(hit, hasId("100")); - } else { - fail("Returned documents should belong to either index2 or index3"); - } - } - } - @Test public void testMinScore() throws ExecutionException, InterruptedException { createIndex("test");