@Override
  protected void doMerge(Mapper mergeWith, boolean updateAllTypes) {
    super.doMerge(mergeWith, updateAllTypes);
    ParentFieldMapper fieldMergeWith = (ParentFieldMapper) mergeWith;
    if (Objects.equals(parentType, fieldMergeWith.parentType) == false) {
      throw new IllegalArgumentException(
          "The _parent field's type option can't be changed: ["
              + parentType
              + "]->["
              + fieldMergeWith.parentType
              + "]");
    }

    List<String> conflicts = new ArrayList<>();
    fieldType()
        .checkCompatibility(
            fieldMergeWith.fieldType(), conflicts, true); // always strict, this cannot change
    parentJoinFieldType.checkCompatibility(
        fieldMergeWith.parentJoinFieldType, conflicts, true); // same here
    if (childJoinFieldType != null) {
      // TODO: this can be set to false when the old parent/child impl is removed, we can do eager
      // global ordinals loading per type.
      childJoinFieldType.checkCompatibility(
          fieldMergeWith.childJoinFieldType, conflicts, updateAllTypes == false);
    }
    if (conflicts.isEmpty() == false) {
      throw new IllegalArgumentException("Merge conflicts: " + conflicts);
    }

    if (active()) {
      childJoinFieldType = fieldMergeWith.childJoinFieldType.clone();
    }
  }
 @Override
 public void checkCompatibility(
     MappedFieldType fieldType, List<String> conflicts, boolean strict) {
   super.checkCompatibility(fieldType, conflicts, strict);
   CompletionFieldType other = (CompletionFieldType) fieldType;
   if (analyzingSuggestLookupProvider.hasPayloads()
       != other.analyzingSuggestLookupProvider.hasPayloads()) {
     conflicts.add("mapper [" + names().fullName() + "] has different payload values");
   }
   if (analyzingSuggestLookupProvider.getPreservePositionsIncrements()
       != other.analyzingSuggestLookupProvider.getPreservePositionsIncrements()) {
     conflicts.add(
         "mapper ["
             + names().fullName()
             + "] has different 'preserve_position_increments' values");
   }
   if (analyzingSuggestLookupProvider.getPreserveSep()
       != other.analyzingSuggestLookupProvider.getPreserveSep()) {
     conflicts.add(
         "mapper [" + names().fullName() + "] has different 'preserve_separators' values");
   }
   if (!ContextMapping.mappingsAreEqual(getContextMapping(), other.getContextMapping())) {
     conflicts.add("mapper [" + names().fullName() + "] has different 'context_mapping' values");
   }
 }
 @Override
 public void checkCompatibility(
     MappedFieldType fieldType, List<String> conflicts, boolean strict) {
   super.checkCompatibility(fieldType, conflicts, strict);
   if (strict) {
     FieldNamesFieldType other = (FieldNamesFieldType) fieldType;
     if (isEnabled() != other.isEnabled()) {
       conflicts.add(
           "mapper ["
               + name()
               + "] is used by multiple types. Set update_all_types to true to update [enabled] across all types.");
     }
   }
 }
Esempio n. 4
0
    @Override
    public void checkCompatibility(
        MappedFieldType fieldType, List<String> conflicts, boolean strict) {
      super.checkCompatibility(fieldType, conflicts, strict);
      GeoShapeFieldType other = (GeoShapeFieldType) fieldType;
      // prevent user from changing strategies
      if (strategyName().equals(other.strategyName()) == false) {
        conflicts.add("mapper [" + names().fullName() + "] has different [strategy]");
      }

      // prevent user from changing trees (changes encoding)
      if (tree().equals(other.tree()) == false) {
        conflicts.add("mapper [" + names().fullName() + "] has different [tree]");
      }

      if ((pointsOnly() != other.pointsOnly())) {
        conflicts.add("mapper [" + names().fullName() + "] has different points_only");
      }

      // TODO we should allow this, but at the moment levels is used to build bookkeeping variables
      // in lucene's SpatialPrefixTree implementations, need a patch to correct that first
      if (treeLevels() != other.treeLevels()) {
        conflicts.add("mapper [" + names().fullName() + "] has different [tree_levels]");
      }
      if (precisionInMeters() != other.precisionInMeters()) {
        conflicts.add("mapper [" + names().fullName() + "] has different [precision]");
      }

      if (strict) {
        if (orientation() != other.orientation()) {
          conflicts.add(
              "mapper ["
                  + names().fullName()
                  + "] is used by multiple types. Set update_all_types to true to update [orientation] across all types.");
        }
        if (distanceErrorPct() != other.distanceErrorPct()) {
          conflicts.add(
              "mapper ["
                  + names().fullName()
                  + "] is used by multiple types. Set update_all_types to true to update [distance_error_pct] across all types.");
        }
      }
    }
 @Override
 public void checkCompatibility(
     MappedFieldType fieldType, List<String> conflicts, boolean strict) {
   super.checkCompatibility(fieldType, conflicts, strict);
   GeoPointFieldType other = (GeoPointFieldType) fieldType;
   if (isLatLonEnabled() != other.isLatLonEnabled()) {
     conflicts.add("mapper [" + names().fullName() + "] has different lat_lon");
   }
   if (isGeohashEnabled() != other.isGeohashEnabled()) {
     conflicts.add("mapper [" + names().fullName() + "] has different geohash");
   }
   if (geohashPrecision() != other.geohashPrecision()) {
     conflicts.add("mapper [" + names().fullName() + "] has different geohash_precision");
   }
   if (isGeohashPrefixEnabled() != other.isGeohashPrefixEnabled()) {
     conflicts.add("mapper [" + names().fullName() + "] has different geohash_prefix");
   }
   if (isLatLonEnabled()
       && other.isLatLonEnabled()
       && latFieldType().numericPrecisionStep() != other.latFieldType().numericPrecisionStep()) {
     conflicts.add("mapper [" + names().fullName() + "] has different precision_step");
   }
 }