@@ -289,22 +289,6 @@ public String toString() {
289289 return super .toString () + ",prefixChars=" + minChars + ":" + maxChars ;
290290 }
291291
292- @ Override
293- public void checkCompatibility (MappedFieldType other , List <String > conflicts , boolean strict ) {
294- super .checkCompatibility (other , conflicts , strict );
295- if (strict ) {
296- PrefixFieldType otherFieldType = (PrefixFieldType ) other ;
297- if (otherFieldType .minChars != this .minChars ) {
298- conflicts .add ("mapper [" + name () + "] is used by multiple types. Set update_all_types to true to update "
299- + "[index_prefixes.min_chars] across all types." );
300- }
301- if (otherFieldType .maxChars != this .maxChars ) {
302- conflicts .add ("mapper [" + name () + "] is used by multiple types. Set update_all_types to true to update "
303- + "[index_prefixes.max_chars] across all types." );
304- }
305- }
306- }
307-
308292 @ Override
309293 public Query existsQuery (QueryShardContext context ) {
310294 throw new UnsupportedOperationException ();
@@ -408,6 +392,19 @@ public void checkCompatibility(MappedFieldType other,
408392 List <String > conflicts , boolean strict ) {
409393 super .checkCompatibility (other , conflicts , strict );
410394 TextFieldType otherType = (TextFieldType ) other ;
395+ if (Objects .equals (this .prefixFieldType , otherType .prefixFieldType ) == false ) {
396+ if (this .prefixFieldType == null ) {
397+ conflicts .add ("mapper [" + name ()
398+ + "] has different [index_prefixes] settings, cannot change from disabled to enabled" );
399+ }
400+ else if (otherType .prefixFieldType == null ) {
401+ conflicts .add ("mapper [" + name ()
402+ + "] has different [index_prefixes] settings, cannot change from enabled to disabled" );
403+ }
404+ else {
405+ conflicts .add ("mapper [" + name () + "] has different [index_prefixes] settings" );
406+ }
407+ }
411408 if (strict ) {
412409 if (fielddata () != otherType .fielddata ()) {
413410 conflicts .add ("mapper [" + name () + "] is used by multiple types. Set update_all_types to true to update [fielddata] "
@@ -425,10 +422,6 @@ public void checkCompatibility(MappedFieldType other,
425422 conflicts .add ("mapper [" + name () + "] is used by multiple types. Set update_all_types to true to update "
426423 + "[fielddata_frequency_filter.min_segment_size] across all types." );
427424 }
428- if (Objects .equals (this .prefixFieldType , ((TextFieldType ) other ).prefixFieldType ) == false ) {
429- conflicts .add ("mapper [" + name () + "] is used by multiple types. Set update_all_types to true to update "
430- + "[index_prefixes] across all types." );
431- }
432425 }
433426 }
434427
@@ -521,6 +514,7 @@ public IndexFieldData.Builder fielddataBuilder(String fullyQualifiedIndexName) {
521514 }
522515 return new PagedBytesIndexFieldData .Builder (fielddataMinFrequency , fielddataMaxFrequency , fielddataMinSegmentSize );
523516 }
517+
524518 }
525519
526520 private Boolean includeInAll ;
0 commit comments