diff --git a/core/src/test/java/org/elasticsearch/search/functionscore/DecayFunctionScoreIT.java b/core/src/test/java/org/elasticsearch/search/functionscore/DecayFunctionScoreIT.java index e17f7bb3efd..1418f476e00 100644 --- a/core/src/test/java/org/elasticsearch/search/functionscore/DecayFunctionScoreIT.java +++ b/core/src/test/java/org/elasticsearch/search/functionscore/DecayFunctionScoreIT.java @@ -254,10 +254,19 @@ public class DecayFunctionScoreIT extends ESIntegTestCase { } public void testBoostModeSettingWorks() throws Exception { - assertAcked(prepareCreate("test").addMapping( + Settings settings = Settings.builder().put(IndexMetaData.INDEX_NUMBER_OF_SHARDS_SETTING.getKey(), 1).build(); + assertAcked(prepareCreate("test").setSettings(settings) + .addMapping( "type1", - jsonBuilder().startObject().startObject("type1").startObject("properties").startObject("test").field("type", "text") - .endObject().startObject("loc").field("type", "geo_point").endObject().endObject().endObject().endObject())); + jsonBuilder() + .startObject() + .startObject("type1") + .startObject("properties") + .startObject("test").field("type", "text").endObject() + .startObject("loc").field("type", "geo_point").endObject() + .endObject() + .endObject() + .endObject())); ensureYellow(); List indexBuilders = new ArrayList<>(); diff --git a/core/src/test/java/org/elasticsearch/search/functionscore/ExplainableScriptIT.java b/core/src/test/java/org/elasticsearch/search/functionscore/ExplainableScriptIT.java index eabae8be055..4e929017ebf 100644 --- a/core/src/test/java/org/elasticsearch/search/functionscore/ExplainableScriptIT.java +++ b/core/src/test/java/org/elasticsearch/search/functionscore/ExplainableScriptIT.java @@ -86,7 +86,7 @@ public class ExplainableScriptIT extends ESIntegTestCase { assertThat(hit.getId(), equalTo(Integer.toString(idCounter))); assertThat(hit.explanation().toString(), containsString(Double.toString(idCounter) + " = This script returned " + Double.toString(idCounter))); - assertThat(hit.explanation().toString(), containsString("1.0 = tf(freq=1.0), with freq of")); + assertThat(hit.explanation().toString(), containsString("freq=1.0 = termFreq=1.0")); assertThat(hit.explanation().getDetails().length, equalTo(2)); idCounter--; } diff --git a/core/src/test/java/org/elasticsearch/search/nested/SimpleNestedIT.java b/core/src/test/java/org/elasticsearch/search/nested/SimpleNestedIT.java index e0aec941487..07865d6c2b4 100644 --- a/core/src/test/java/org/elasticsearch/search/nested/SimpleNestedIT.java +++ b/core/src/test/java/org/elasticsearch/search/nested/SimpleNestedIT.java @@ -317,8 +317,8 @@ public class SimpleNestedIT extends ESIntegTestCase { assertNoFailures(searchResponse); assertThat(searchResponse.getHits().totalHits(), equalTo(1L)); Explanation explanation = searchResponse.getHits().hits()[0].explanation(); - assertThat(explanation.getValue(), equalTo(2f)); - assertThat(explanation.toString(), startsWith("2.0 = sum of:\n 2.0 = Score based on 2 child docs in range from 0 to 1")); + assertThat(explanation.getValue(), equalTo(searchResponse.getHits().getHits()[0].score())); + assertThat(explanation.toString(), startsWith("0.36464313 = sum of:\n 0.36464313 = Score based on 2 child docs in range from 0 to 1")); } public void testSimpleNestedSorting() throws Exception { diff --git a/core/src/test/java/org/elasticsearch/search/query/MultiMatchQueryIT.java b/core/src/test/java/org/elasticsearch/search/query/MultiMatchQueryIT.java index 33ef2b97216..875256a0f92 100644 --- a/core/src/test/java/org/elasticsearch/search/query/MultiMatchQueryIT.java +++ b/core/src/test/java/org/elasticsearch/search/query/MultiMatchQueryIT.java @@ -439,8 +439,8 @@ public class MultiMatchQueryIT extends ESIntegTestCase { .setQuery(randomizeType(multiMatchQuery("marvel hero captain america", "full_name", "first_name", "last_name", "category") .type(MultiMatchQueryBuilder.Type.CROSS_FIELDS) .operator(Operator.OR))).get(); - assertFirstHit(searchResponse, hasId("theone")); - assertSecondHit(searchResponse, hasId("theother")); + assertFirstHit(searchResponse, hasId("theother")); + assertSecondHit(searchResponse, hasId("theone")); assertThat(searchResponse.getHits().hits()[0].getScore(), greaterThan(searchResponse.getHits().hits()[1].getScore())); searchResponse = client().prepareSearch("test") 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 5e4a7d6f77f..8cb21dadb9b 100644 --- a/core/src/test/java/org/elasticsearch/search/query/SearchQueryIT.java +++ b/core/src/test/java/org/elasticsearch/search/query/SearchQueryIT.java @@ -283,8 +283,8 @@ public class SearchQueryIT extends ESIntegTestCase { searchResponse = client().prepareSearch("test").setQuery( boolQuery().must(matchAllQuery()).must(constantScoreQuery(matchAllQuery()))).get(); assertHitCount(searchResponse, 2L); - assertThat((double)searchResponse.getHits().getAt(0).score(), closeTo(Math.sqrt(2), 0.1)); - assertThat((double)searchResponse.getHits().getAt(1).score(),closeTo(Math.sqrt(2), 0.1)); + assertThat((double)searchResponse.getHits().getAt(0).score(), closeTo(2.0, 0.1)); + assertThat((double)searchResponse.getHits().getAt(1).score(),closeTo(2.0, 0.1)); } } @@ -336,8 +336,8 @@ public class SearchQueryIT extends ESIntegTestCase { searchResponse = client().prepareSearch().setQuery(commonTermsQuery("field1", "the lazy fox brown").cutoffFrequency(1).highFreqMinimumShouldMatch("3")).get(); assertHitCount(searchResponse, 2L); - assertFirstHit(searchResponse, hasId("1")); - assertSecondHit(searchResponse, hasId("2")); + assertFirstHit(searchResponse, hasId("2")); + assertSecondHit(searchResponse, hasId("1")); searchResponse = client().prepareSearch().setQuery(commonTermsQuery("field1", "the lazy fox brown").cutoffFrequency(1).highFreqMinimumShouldMatch("4")).get(); assertHitCount(searchResponse, 1L); @@ -377,9 +377,9 @@ public class SearchQueryIT extends ESIntegTestCase { // try the same with multi match query searchResponse = client().prepareSearch().setQuery(multiMatchQuery("the quick brown", "field1", "field2").cutoffFrequency(3).operator(Operator.AND)).get(); assertHitCount(searchResponse, 3L); - assertFirstHit(searchResponse, hasId("1")); - assertSecondHit(searchResponse, hasId("2")); - assertThirdHit(searchResponse, hasId("3")); + assertFirstHit(searchResponse, hasId("3")); + assertSecondHit(searchResponse, hasId("1")); + assertThirdHit(searchResponse, hasId("2")); } public void testCommonTermsQueryStackedTokens() throws Exception { @@ -423,8 +423,8 @@ public class SearchQueryIT extends ESIntegTestCase { searchResponse = client().prepareSearch().setQuery(commonTermsQuery("field1", "the fast lazy fox brown").cutoffFrequency(1).highFreqMinimumShouldMatch("5")).get(); assertHitCount(searchResponse, 2L); - assertFirstHit(searchResponse, hasId("1")); - assertSecondHit(searchResponse, hasId("2")); + assertFirstHit(searchResponse, hasId("2")); + assertSecondHit(searchResponse, hasId("1")); searchResponse = client().prepareSearch().setQuery(commonTermsQuery("field1", "the fast lazy fox brown").cutoffFrequency(1).highFreqMinimumShouldMatch("6")).get(); assertHitCount(searchResponse, 1L); @@ -469,9 +469,9 @@ public class SearchQueryIT extends ESIntegTestCase { // try the same with multi match query searchResponse = client().prepareSearch().setQuery(multiMatchQuery("the fast brown", "field1", "field2").cutoffFrequency(3).operator(Operator.AND)).get(); assertHitCount(searchResponse, 3L); - assertFirstHit(searchResponse, hasId("1")); - assertSecondHit(searchResponse, hasId("2")); - assertThirdHit(searchResponse, hasId("3")); + assertFirstHit(searchResponse, hasId("3")); + assertSecondHit(searchResponse, hasId("1")); + assertThirdHit(searchResponse, hasId("2")); } public void testQueryStringAnalyzedWildcard() throws Exception { diff --git a/docs/plugins/mapper-attachments.asciidoc b/docs/plugins/mapper-attachments.asciidoc index 86e80cb1a26..b287decd4cf 100644 --- a/docs/plugins/mapper-attachments.asciidoc +++ b/docs/plugins/mapper-attachments.asciidoc @@ -88,10 +88,10 @@ If you get a hit for your indexed document, the plugin should be installed and w "took": 53, "hits": { "total": 1, - "max_score": 0.3125, + "max_score": 0.25811607, "hits": [ { - "_score": 0.3125, + "_score": 0.25811607, "_index": "trying-out-mapper-attachments", "_type": "person", "_id": "1", diff --git a/docs/reference/analysis/charfilters/pattern-replace-charfilter.asciidoc b/docs/reference/analysis/charfilters/pattern-replace-charfilter.asciidoc index 24cd203ae26..9299eb800b5 100644 --- a/docs/reference/analysis/charfilters/pattern-replace-charfilter.asciidoc +++ b/docs/reference/analysis/charfilters/pattern-replace-charfilter.asciidoc @@ -230,13 +230,13 @@ The output from the above is: }, "hits": { "total": 1, - "max_score": 0.4375, + "max_score": 0.2824934, "hits": [ { "_index": "my_index", "_type": "my_doc", "_id": "1", - "_score": 0.4375, + "_score": 0.2824934, "_source": { "text": "The fooBarBaz method" }, diff --git a/docs/reference/analysis/tokenizers/edgengram-tokenizer.asciidoc b/docs/reference/analysis/tokenizers/edgengram-tokenizer.asciidoc index 2328354998e..0728767896a 100644 --- a/docs/reference/analysis/tokenizers/edgengram-tokenizer.asciidoc +++ b/docs/reference/analysis/tokenizers/edgengram-tokenizer.asciidoc @@ -302,13 +302,13 @@ GET my_index/_search }, "hits": { "total": 1, - "max_score": 0.44194174, + "max_score": 0.51623213, "hits": [ { "_index": "my_index", "_type": "doc", "_id": "1", - "_score": 0.44194174, + "_score": 0.51623213, "_source": { "title": "Quick Foxes" } diff --git a/docs/reference/search/uri-request.asciidoc b/docs/reference/search/uri-request.asciidoc index 9aa9c17727e..496f04ea4af 100644 --- a/docs/reference/search/uri-request.asciidoc +++ b/docs/reference/search/uri-request.asciidoc @@ -27,13 +27,13 @@ And here is a sample response: }, "hits":{ "total" : 1, - "max_score": 1.0, + "max_score": 0.2876821, "hits" : [ { "_index" : "twitter", "_type" : "tweet", "_id" : "0", - "_score": 1.0, + "_score": 0.2876821, "_source" : { "user" : "kimchy", "date" : "2009-11-15T14:12:12", diff --git a/modules/percolator/src/test/resources/rest-api-spec/test/percolate/16_existing_doc.yaml b/modules/percolator/src/test/resources/rest-api-spec/test/percolate/16_existing_doc.yaml index 9da8b33b996..2d15e2cd222 100644 --- a/modules/percolator/src/test/resources/rest-api-spec/test/percolate/16_existing_doc.yaml +++ b/modules/percolator/src/test/resources/rest-api-spec/test/percolate/16_existing_doc.yaml @@ -114,5 +114,5 @@ term: tag: tag1 - - match: {'matches': [{_index: percolator_index, _id: test_percolator, _score: 1.0}]} + - match: {'matches': [{_index: percolator_index, _id: test_percolator, _score: 0.2876821}]}