diff --git a/core/src/main/java/org/elasticsearch/index/mapper/core/StringFieldMapper.java b/core/src/main/java/org/elasticsearch/index/mapper/core/StringFieldMapper.java index 903660388730d..60ef42a43a91a 100644 --- a/core/src/main/java/org/elasticsearch/index/mapper/core/StringFieldMapper.java +++ b/core/src/main/java/org/elasticsearch/index/mapper/core/StringFieldMapper.java @@ -65,20 +65,20 @@ public static class Defaults { // NOTE, when adding defaults here, make sure you add them in the builder public static final String NULL_VALUE = null; /** - * Post 2.1 default for position_offset_gap. Set to 100 so that + * Post 2.0 default for position_offset_gap. Set to 100 so that * phrase queries of reasonably high slop will not match across field * values. */ public static final int POSITION_OFFSET_GAP = 100; - public static final int POSITION_OFFSET_GAP_PRE_2_1 = 0; + public static final int POSITION_OFFSET_GAP_PRE_2_0 = 0; public static final int IGNORE_ABOVE = -1; /** * The default position_offset_gap for a particular version of Elasticsearch. */ public static int positionOffsetGap(Version version) { - if (version.before(Version.V_2_1_0)) { - return POSITION_OFFSET_GAP_PRE_2_1; + if (version.before(Version.V_2_0_0_beta1)) { + return POSITION_OFFSET_GAP_PRE_2_0; } return POSITION_OFFSET_GAP; } diff --git a/core/src/test/java/org/elasticsearch/bwcompat/OldIndexBackwardsCompatibilityIT.java b/core/src/test/java/org/elasticsearch/bwcompat/OldIndexBackwardsCompatibilityIT.java index 1efc9e888a56c..7b64f4574352a 100644 --- a/core/src/test/java/org/elasticsearch/bwcompat/OldIndexBackwardsCompatibilityIT.java +++ b/core/src/test/java/org/elasticsearch/bwcompat/OldIndexBackwardsCompatibilityIT.java @@ -446,7 +446,7 @@ void assertDeleteByQueryWorked(String indexName, Version version) throws Excepti } void assertPositionOffsetGapDefaults(String indexName, Version version) throws Exception { - if (version.before(Version.V_2_1_0)) { + if (version.before(Version.V_2_0_0_beta1)) { StringFieldMapperPositionOffsetGapTests.assertGapIsZero(client(), indexName, "doc"); } else { StringFieldMapperPositionOffsetGapTests.assertGapIsOneHundred(client(), indexName, "doc"); diff --git a/docs/reference/migration/migrate_2_0/mapping.asciidoc b/docs/reference/migration/migrate_2_0/mapping.asciidoc index a50fc9c6a6221..67cd214109264 100644 --- a/docs/reference/migration/migrate_2_0/mapping.asciidoc +++ b/docs/reference/migration/migrate_2_0/mapping.asciidoc @@ -384,7 +384,10 @@ The `compress` and `compress_threshold` options have been removed from the default. If you would like to increase compression levels, use the new <> setting instead. - - - - +==== position_offset_gap +The default `position_offset_gap` is now 100. Indexes created in Elasticsearch +2.0.0 will default to using 100 and indexes created before that will continue +to use the old default of 0. This was done to prevent phrase queries from +matching across different values of the same term unexpectedly. Specifically, +100 was chosen to cause phrase queries with slops up to 99 to match only within +a single value of a field. diff --git a/docs/reference/migration/migrate_2_1.asciidoc b/docs/reference/migration/migrate_2_1.asciidoc index 659f33e94829f..7542fb3d1dfdb 100644 --- a/docs/reference/migration/migrate_2_1.asciidoc +++ b/docs/reference/migration/migrate_2_1.asciidoc @@ -25,13 +25,3 @@ GET /my_index/_search?scroll=2m Scroll requests sorted by `_doc` have been optimized to more efficiently resume from where the previous request stopped, so this will have the same performance characteristics as the former `scan` search type. - -=== Mapping changes - -==== position_offset_gap -The default `position_offset_gap` is now 100. Indexes created in Elasticsearch -2.1.0 will default to using 100 and indexes created before that will continue -to use the old default of 0. This was done to prevent phrase queries from -matching across different values of the same term unexpectedly. Specifically, -100 was chosen to cause phrase queries with slops up to 99 to match only within -a single value of a field.