@@ -88,6 +88,9 @@ public void testLegacyLatLonValues() throws Exception {
8888 } else {
8989 assertThat (Long .parseLong (doc .rootDoc ().get ("point" )), equalTo (GeoPointField .encodeLatLon (1.2 , 1.3 )));
9090 }
91+ if (version .before (LatLonPointFieldMapper .LAT_LON_FIELD_VERSION )) {
92+ assertWarnings ("geo_point lat_lon parameter is deprecated and will be removed in the next major release" );
93+ }
9194 }
9295
9396 public void testLegacyLatLonValuesWithGeohash () throws Exception {
@@ -113,6 +116,10 @@ public void testLegacyLatLonValuesWithGeohash() throws Exception {
113116 } else {
114117 assertThat (doc .rootDoc ().get ("point.geohash" ), equalTo (stringEncode (1.3 , 1.2 )));
115118 }
119+ if (version .before (LatLonPointFieldMapper .LAT_LON_FIELD_VERSION )) {
120+ assertWarnings ("geo_point lat_lon parameter is deprecated and will be removed in the next major release" ,
121+ "geo_point geohash parameter is deprecated and will be removed in the next major release" );
122+ }
116123 }
117124
118125 public void testLegacyLatLonInOneValueWithGeohash () throws Exception {
@@ -137,6 +144,10 @@ public void testLegacyLatLonInOneValueWithGeohash() throws Exception {
137144 } else {
138145 assertThat (doc .rootDoc ().get ("point.geohash" ), equalTo (stringEncode (1.3 , 1.2 )));
139146 }
147+ if (version .before (LatLonPointFieldMapper .LAT_LON_FIELD_VERSION )) {
148+ assertWarnings ("geo_point lat_lon parameter is deprecated and will be removed in the next major release" ,
149+ "geo_point geohash parameter is deprecated and will be removed in the next major release" );
150+ }
140151 }
141152
142153 public void testLegacyGeoHashIndexValue () throws Exception {
@@ -161,6 +172,10 @@ public void testLegacyGeoHashIndexValue() throws Exception {
161172 } else {
162173 assertThat (doc .rootDoc ().get ("point.geohash" ), equalTo (stringEncode (1.3 , 1.2 )));
163174 }
175+ if (version .before (LatLonPointFieldMapper .LAT_LON_FIELD_VERSION )) {
176+ assertWarnings ("geo_point lat_lon parameter is deprecated and will be removed in the next major release" ,
177+ "geo_point geohash parameter is deprecated and will be removed in the next major release" );
178+ }
164179 }
165180
166181 public void testGeoHashValue () throws Exception {
@@ -184,6 +199,7 @@ public void testGeoHashValue() throws Exception {
184199 if (version .before (LatLonPointFieldMapper .LAT_LON_FIELD_VERSION )) {
185200 assertThat (doc .rootDoc ().getField ("point.lat" ), notNullValue ());
186201 assertThat (doc .rootDoc ().getField ("point.lon" ), notNullValue ());
202+ assertWarnings ("geo_point lat_lon parameter is deprecated and will be removed in the next major release" );
187203 }
188204 }
189205
@@ -309,6 +325,9 @@ public void testLegacyValidateLatLonValues() throws Exception {
309325 .bytes ()));
310326 assertThat (e .getRootCause (), instanceOf (NumberFormatException .class ));
311327 assertThat (e .getRootCause ().toString (), containsString ("java.lang.NumberFormatException: For input string: \" -\" " ));
328+ if (version .before (LatLonPointFieldMapper .LAT_LON_FIELD_VERSION )) {
329+ assertWarnings ("geo_point lat_lon parameter is deprecated and will be removed in the next major release" );
330+ }
312331 }
313332
314333 public void testNoValidateLegacyLatLonValues () throws Exception {
@@ -370,6 +389,10 @@ public void testNoValidateLegacyLatLonValues() throws Exception {
370389 .startObject ("point" ).field ("lat" , "-" ).field ("lon" , "-" ).endObject ()
371390 .endObject ()
372391 .bytes ());
392+
393+ if (version .before (LatLonPointFieldMapper .LAT_LON_FIELD_VERSION )) {
394+ assertWarnings ("geo_point lat_lon parameter is deprecated and will be removed in the next major release" );
395+ }
373396 }
374397
375398 public void testLatLonValuesStored () throws Exception {
@@ -449,6 +472,9 @@ public void testArrayLatLonValues() throws Exception {
449472 assertThat (Long .parseLong (doc .rootDoc ().getFields ("point" )[1 ].stringValue ()), equalTo (GeoPointField .encodeLatLon (1.4 , 1.5 )));
450473 }
451474 }
475+ if (version .before (LatLonPointFieldMapper .LAT_LON_FIELD_VERSION )) {
476+ assertWarnings ("geo_point lat_lon parameter is deprecated and will be removed in the next major release" );
477+ }
452478 }
453479
454480 public void testLatLonInOneValue () throws Exception {
@@ -479,6 +505,9 @@ public void testLatLonInOneValue() throws Exception {
479505 assertThat (Long .parseLong (doc .rootDoc ().getFields ("point" )[0 ].stringValue ()), equalTo (GeoPointField .encodeLatLon (1.2 , 1.3 )));
480506 }
481507 }
508+ if (version .before (LatLonPointFieldMapper .LAT_LON_FIELD_VERSION )) {
509+ assertWarnings ("geo_point lat_lon parameter is deprecated and will be removed in the next major release" );
510+ }
482511 }
483512
484513 public void testLatLonInOneValueStored () throws Exception {
@@ -511,6 +540,9 @@ public void testLatLonInOneValueStored() throws Exception {
511540 equalTo (GeoPointField .encodeLatLon (1.2 , 1.3 )));
512541 }
513542 }
543+ if (version .before (LatLonPointFieldMapper .LAT_LON_FIELD_VERSION )) {
544+ assertWarnings ("geo_point lat_lon parameter is deprecated and will be removed in the next major release" );
545+ }
514546 }
515547
516548 public void testLatLonInOneValueArray () throws Exception {
@@ -557,6 +589,9 @@ public void testLatLonInOneValueArray() throws Exception {
557589 } else if (version .before (LatLonPointFieldMapper .LAT_LON_FIELD_VERSION )) {
558590 assertThat (Long .parseLong (doc .rootDoc ().getFields ("point" )[1 ].stringValue ()), equalTo (GeoPointField .encodeLatLon (1.4 , 1.5 )));
559591 }
592+ if (version .before (LatLonPointFieldMapper .LAT_LON_FIELD_VERSION )) {
593+ assertWarnings ("geo_point lat_lon parameter is deprecated and will be removed in the next major release" );
594+ }
560595 }
561596
562597 public void testLonLatArray () throws Exception {
@@ -585,6 +620,7 @@ public void testLonLatArray() throws Exception {
585620 } else {
586621 assertThat (Long .parseLong (doc .rootDoc ().getFields ("point" )[0 ].stringValue ()), equalTo (GeoPointField .encodeLatLon (1.2 , 1.3 )));
587622 }
623+ assertWarnings ("geo_point lat_lon parameter is deprecated and will be removed in the next major release" );
588624 }
589625 }
590626
@@ -629,6 +665,10 @@ public void testLonLatArrayStored() throws Exception {
629665 Settings settings = Settings .builder ().put (IndexMetaData .SETTING_VERSION_CREATED , version ).build ();
630666 DocumentMapper defaultMapper = createIndex ("test" , settings ).mapperService ().documentMapperParser ().parse ("type" , new CompressedXContent (mapping ));
631667
668+ if (version .before (LatLonPointFieldMapper .LAT_LON_FIELD_VERSION )) {
669+ assertWarnings ("geo_point lat_lon parameter is deprecated and will be removed in the next major release" );
670+ }
671+
632672 ParsedDocument doc = defaultMapper .parse ("test" , "type" , "1" , XContentFactory .jsonBuilder ()
633673 .startObject ()
634674 .startArray ("point" ).value (1.3 ).value (1.2 ).endArray ()
@@ -694,6 +734,9 @@ public void testLonLatArrayArrayStored() throws Exception {
694734 } else if (version .onOrAfter (LatLonPointFieldMapper .LAT_LON_FIELD_VERSION )) {
695735 assertThat (doc .rootDoc ().getFields ("point" ).length , CoreMatchers .equalTo (4 ));
696736 }
737+ if (version .before (LatLonPointFieldMapper .LAT_LON_FIELD_VERSION )) {
738+ assertWarnings ("geo_point lat_lon parameter is deprecated and will be removed in the next major release" );
739+ }
697740 }
698741
699742
@@ -797,6 +840,11 @@ public void testOptionDeprecation() throws Exception {
797840 parser .parse ("type" , new CompressedXContent (normalizeMapping )));
798841 assertEquals (e .getMessage (), "Mapping definition for [point] has unsupported parameters: [normalize_lon : true]" );
799842 }
843+
844+ if (version .before (LatLonPointFieldMapper .LAT_LON_FIELD_VERSION )) {
845+ assertWarnings ("geo_point lat_lon parameter is deprecated and will be removed in the next major release" ,
846+ "geo_point geohash parameter is deprecated and will be removed in the next major release" );
847+ }
800848 }
801849
802850 public void testLegacyGeoPointMapperMerge () throws Exception {
@@ -821,6 +869,10 @@ public void testLegacyGeoPointMapperMerge() throws Exception {
821869 .startObject ("properties" ).startObject ("point" ).field ("type" , "geo_point" ).field ("lat_lon" , true )
822870 .field ("geohash" , true ).endObject ().endObject ().endObject ().endObject ().string ();
823871 mapperService .merge ("type" , new CompressedXContent (stage2MappingCorrect ), MapperService .MergeReason .MAPPING_UPDATE , false );
872+ if (version .before (LatLonPointFieldMapper .LAT_LON_FIELD_VERSION )) {
873+ assertWarnings ("geo_point lat_lon parameter is deprecated and will be removed in the next major release" ,
874+ "geo_point geohash parameter is deprecated and will be removed in the next major release" );
875+ }
824876 }
825877
826878 public void testLegacyGeoHashSearch () throws Exception {
0 commit comments