Tabnine Logo
FieldMapper$MultiFields
Code IndexAdd Tabnine to your IDE (free)

How to use
FieldMapper$MultiFields
in
org.elasticsearch.index.mapper

Best Java code snippets using org.elasticsearch.index.mapper.FieldMapper$MultiFields (Showing top 20 results out of 315)

origin: org.elasticsearch/elasticsearch

@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
  builder.startObject(simpleName())
      .field(Fields.TYPE.getPreferredName(), CONTENT_TYPE);
  builder.field(Fields.ANALYZER.getPreferredName(), fieldType().indexAnalyzer().name());
  if (fieldType().indexAnalyzer().name().equals(fieldType().searchAnalyzer().name()) == false) {
    builder.field(Fields.SEARCH_ANALYZER.getPreferredName(), fieldType().searchAnalyzer().name());
  }
  builder.field(Fields.PRESERVE_SEPARATORS.getPreferredName(), fieldType().preserveSep());
  builder.field(Fields.PRESERVE_POSITION_INCREMENTS.getPreferredName(), fieldType().preservePositionIncrements());
  builder.field(Fields.MAX_INPUT_LENGTH.getPreferredName(), this.maxInputLength);
  if (fieldType().hasContextMappings()) {
    builder.startArray(Fields.CONTEXTS.getPreferredName());
    fieldType().getContextMappings().toXContent(builder, params);
    builder.endArray();
  }
  multiFields.toXContent(builder, params);
  return builder.endObject();
}
origin: org.elasticsearch/elasticsearch

if (multiFields.iterator().hasNext()) {
  multiFields.parse(this, context.createExternalValueContext(point.geohash()));
origin: harbby/presto-connectors

/**
 * Merge changes coming from {@code mergeWith} in place.
 * @param updateAllTypes TODO
 */
protected void doMerge(Mapper mergeWith, boolean updateAllTypes) {
  if (!this.getClass().equals(mergeWith.getClass())) {
    String mergedType = mergeWith.getClass().getSimpleName();
    if (mergeWith instanceof FieldMapper) {
      mergedType = ((FieldMapper) mergeWith).contentType();
    }
    throw new IllegalArgumentException("mapper [" + fieldType().names().fullName() + "] of different type, current_type [" + contentType() + "], merged_type [" + mergedType + "]");
  }
  FieldMapper fieldMergeWith = (FieldMapper) mergeWith;
  multiFields = multiFields.merge(fieldMergeWith.multiFields);
  // apply changeable values
  this.fieldType = fieldMergeWith.fieldType;
  this.copyTo = fieldMergeWith.copyTo;
}
origin: com.strapdata.elasticsearch/elasticsearch

  multiFields.parse(this, context);
} else {
  String currentFieldName = null;
origin: harbby/presto-connectors

  multiFields.parse(this, context);
} else {
  String currentFieldName = null;
origin: apache/servicemix-bundles

  context.doc().add(field);
multiFields.parse(this, context);
return null;
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

multiFields.parse(this, externalValueContext);
origin: com.strapdata.elasticsearch/elasticsearch

multiFields.toXContent(builder, params);
origin: harbby/presto-connectors

  builder.field("fielddata", fieldType().fieldDataType().getSettings().getAsMap());
multiFields.toXContent(builder, params);
origin: com.strapdata.elasticsearch/elasticsearch

multiFields.parse(this, context);
return null;
origin: apache/servicemix-bundles

if (multiFields.iterator().hasNext()) {
  multiFields.parse(this, context.createExternalValueContext(point.geohash()));
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

multiFields.toXContent(builder, params);
copyTo.toXContent(builder, params);
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

if (multiFields.iterator().hasNext()) {
  multiFields.parse(this, context.createExternalValueContext(point.geohash()));
origin: com.strapdata.elasticsearch/elasticsearch

  @Override
  public void parse(ParseContext originalContext, GeoPoint point, String geoHash) throws IOException {
    // Geopoint fields, by default, will not be included in _all
    final ParseContext context = originalContext.setIncludeInAllDefault(false);

    if (ignoreMalformed.value() == false) {
      if (point.lat() > 90.0 || point.lat() < -90.0) {
        throw new IllegalArgumentException("illegal latitude value [" + point.lat() + "] for " + name());
      }
      if (point.lon() > 180.0 || point.lon() < -180) {
        throw new IllegalArgumentException("illegal longitude value [" + point.lon() + "] for " + name());
      }
    } else {
      GeoUtils.normalizePoint(point);
    }
    if (fieldType().indexOptions() != IndexOptions.NONE) {
      context.doc().add(new LatLonPoint(fieldType().name(), point.lat(), point.lon()));
    }
    if (fieldType().stored()) {
      context.doc().add(new StoredField(fieldType().name(), point.toString()));
    }
    if (fieldType.hasDocValues()) {
      context.doc().add(new LatLonDocValuesField(fieldType().name(), point.lat(), point.lon()));
    }
    // if the mapping contains multifields then use the geohash string
    if (multiFields.iterator().hasNext()) {
      multiFields.parse(this, context.createExternalValueContext(point.geohash()));
    }
  }
}
origin: com.strapdata.elasticsearch/elasticsearch

@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
  builder.startObject(simpleName())
    .field(Fields.TYPE, CONTENT_TYPE);
  builder.field(Fields.ANALYZER, fieldType().indexAnalyzer().name());
  if (fieldType().indexAnalyzer().name().equals(fieldType().searchAnalyzer().name()) == false) {
    builder.field(Fields.SEARCH_ANALYZER.getPreferredName(), fieldType().searchAnalyzer().name());
  }
  builder.field(Fields.PAYLOADS, fieldType().analyzingSuggestLookupProvider.hasPayloads());
  builder.field(Fields.PRESERVE_SEPARATORS.getPreferredName(),
    fieldType().analyzingSuggestLookupProvider.getPreserveSep());
  builder.field(Fields.PRESERVE_POSITION_INCREMENTS.getPreferredName(),
    fieldType().analyzingSuggestLookupProvider.getPreservePositionsIncrements());
  builder.field(Fields.MAX_INPUT_LENGTH.getPreferredName(), this.maxInputLength);
  multiFields.toXContent(builder, params);
  if (fieldType().requiresContext()) {
    builder.startObject(Fields.CONTEXT);
    for (ContextMapping mapping : fieldType().getContextMapping().values()) {
      builder.value(mapping);
    }
    builder.endObject();
  }
  return builder.endObject();
}
origin: harbby/presto-connectors

public MultiFields merge(MultiFields mergeWith) {
  if (pathType != mergeWith.pathType) {
    throw new IllegalArgumentException("Can't change path type from [" + pathType + "] to [" + mergeWith.pathType + "]");
  }
  ImmutableOpenMap.Builder<String, FieldMapper> newMappersBuilder = ImmutableOpenMap.builder(mappers);
  for (ObjectCursor<FieldMapper> cursor : mergeWith.mappers.values()) {
    FieldMapper mergeWithMapper = cursor.value;
    FieldMapper mergeIntoMapper = mappers.get(mergeWithMapper.simpleName());
    if (mergeIntoMapper == null) {
      // we disable the all in multi-field mappers
      if (mergeWithMapper instanceof AllFieldMapper.IncludeInAll) {
        mergeWithMapper = (FieldMapper) ((AllFieldMapper.IncludeInAll) mergeWithMapper).unsetIncludeInAll();
      }
      newMappersBuilder.put(mergeWithMapper.simpleName(), mergeWithMapper);
    } else {
      FieldMapper merged = mergeIntoMapper.merge(mergeWithMapper, false);
      newMappersBuilder.put(merged.simpleName(), merged); // override previous definition
    }
  }
  ImmutableOpenMap<String, FieldMapper> mappers = newMappersBuilder.build();
  return new MultiFields(pathType, mappers);
}
origin: harbby/presto-connectors

  @SuppressWarnings("unchecked")
  public MultiFields build(FieldMapper.Builder mainFieldBuilder, BuilderContext context) {
    if (pathType == ContentPath.Type.FULL && mapperBuilders.isEmpty()) {
      return empty();
    } else if (mapperBuilders.isEmpty()) {
      return new MultiFields(pathType, ImmutableOpenMap.<String, FieldMapper>of());
    } else {
      ContentPath.Type origPathType = context.path().pathType();
      context.path().pathType(pathType);
      context.path().add(mainFieldBuilder.name());
      ImmutableOpenMap.Builder mapperBuilders = this.mapperBuilders;
      for (ObjectObjectCursor<String, Mapper.Builder> cursor : this.mapperBuilders) {
        String key = cursor.key;
        Mapper.Builder value = cursor.value;
        Mapper mapper = value.build(context);
        assert mapper instanceof FieldMapper;
        mapperBuilders.put(key, mapper);
      }
      context.path().remove();
      context.path().pathType(origPathType);
      ImmutableOpenMap.Builder<String, FieldMapper> mappers = mapperBuilders.cast();
      return new MultiFields(pathType, mappers.build());
    }
  }
}
origin: harbby/presto-connectors

/**
 * Parse using the provided {@link ParseContext} and return a mapping
 * update if dynamic mappings modified the mappings, or {@code null} if
 * mappings were not modified.
 */
public Mapper parse(ParseContext context) throws IOException {
  final List<Field> fields = new ArrayList<>(2);
  try {
    parseCreateField(context, fields);
    for (Field field : fields) {
      if (!customBoost()) {
        field.setBoost(fieldType().boost());
      }
      context.doc().add(field);
    }
  } catch (Exception e) {
    throw new MapperParsingException("failed to parse [" + fieldType().names().fullName() + "]", e);
  }
  multiFields.parse(this, context);
  return null;
}
origin: harbby/presto-connectors

@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
  builder.startObject(simpleName())
    .field(Fields.TYPE, CONTENT_TYPE);
  builder.field(Fields.ANALYZER, fieldType().indexAnalyzer().name());
  if (fieldType().indexAnalyzer().name().equals(fieldType().searchAnalyzer().name()) == false) {
    builder.field(Fields.SEARCH_ANALYZER.getPreferredName(), fieldType().searchAnalyzer().name());
  }
  builder.field(Fields.PAYLOADS, fieldType().analyzingSuggestLookupProvider.hasPayloads());
  builder.field(Fields.PRESERVE_SEPARATORS.getPreferredName(), fieldType().analyzingSuggestLookupProvider.getPreserveSep());
  builder.field(Fields.PRESERVE_POSITION_INCREMENTS.getPreferredName(), fieldType().analyzingSuggestLookupProvider.getPreservePositionsIncrements());
  builder.field(Fields.MAX_INPUT_LENGTH.getPreferredName(), this.maxInputLength);
  multiFields.toXContent(builder, params);
  if (fieldType().requiresContext()) {
    builder.startObject(Fields.CONTEXT);
    for (ContextMapping mapping : fieldType().getContextMapping().values()) {
      builder.value(mapping);
    }
    builder.endObject();
  }
  return builder.endObject();
}
origin: apache/servicemix-bundles

@Override
public FieldMapper updateFieldType(Map<String, MappedFieldType> fullNameToFieldType) {
  final MappedFieldType newFieldType = fullNameToFieldType.get(fieldType.name());
  if (newFieldType == null) {
    // this field does not exist in the mappings yet
    // this can happen if this mapper represents a mapping update
    return this;
  } else if (fieldType.getClass() != newFieldType.getClass()) {
    throw new IllegalStateException("Mixing up field types: " +
      fieldType.getClass() + " != " + newFieldType.getClass() + " on field " + fieldType.name());
  }
  MultiFields updatedMultiFields = multiFields.updateFieldType(fullNameToFieldType);
  if (fieldType == newFieldType && multiFields == updatedMultiFields) {
    return this; // no change
  }
  FieldMapper updated = clone();
  updated.fieldType = newFieldType;
  updated.multiFields = updatedMultiFields;
  return updated;
}
org.elasticsearch.index.mapperFieldMapper$MultiFields

Most used methods

  • empty
  • toXContent
  • <init>
  • iterator
  • merge
  • parse
  • updateFieldType
  • create

Popular in Java

  • Finding current android device location
  • requestLocationUpdates (LocationManager)
  • onCreateOptionsMenu (Activity)
  • getSupportFragmentManager (FragmentActivity)
  • BorderLayout (java.awt)
    A border layout lays out a container, arranging and resizing its components to fit in five regions:
  • Window (java.awt)
    A Window object is a top-level window with no borders and no menubar. The default layout for a windo
  • Date (java.sql)
    A class which can consume and produce dates in SQL Date format. Dates are represented in SQL as yyyy
  • DecimalFormat (java.text)
    A concrete subclass of NumberFormat that formats decimal numbers. It has a variety of features desig
  • HashMap (java.util)
    HashMap is an implementation of Map. All optional operations are supported.All elements are permitte
  • Executor (java.util.concurrent)
    An object that executes submitted Runnable tasks. This interface provides a way of decoupling task s
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now