@Override protected String contentType() { return fieldType.typeName(); }
@Override protected String contentType() { return fieldType.typeName(); }
@Override protected String contentType() { return fieldType.typeName(); }
@Override protected String contentType() { return fieldType.typeName(); }
@Override public String typeName() { return fieldType.typeName(); }
/** * Factory method for range queries. * @param relation the relation, nulls should be interpreted like INTERSECTS */ public Query rangeQuery( Object lowerTerm, Object upperTerm, boolean includeLower, boolean includeUpper, ShapeRelation relation, DateTimeZone timeZone, DateMathParser parser, QueryShardContext context) { throw new IllegalArgumentException("Field [" + name + "] of type [" + typeName() + "] does not support range queries"); }
public Query fuzzyQuery(Object value, Fuzziness fuzziness, int prefixLength, int maxExpansions, boolean transpositions) { throw new IllegalArgumentException("Can only use fuzzy queries on keyword and text fields - not on [" + name + "] which is of type [" + typeName() + "]"); }
/** Checks this type is the same type as other. Adds a conflict if they are different. */ private void checkTypeName(MappedFieldType other) { if (typeName().equals(other.typeName()) == false) { throw new IllegalArgumentException("mapper [" + name + "] cannot be changed from type [" + typeName() + "] to [" + other.typeName() + "]"); } else if (getClass() != other.getClass()) { throw new IllegalStateException("Type names equal for class " + getClass().getSimpleName() + " and " + other.getClass().getSimpleName()); } }
/** Return a fielddata builder for this field * @throws IllegalArgumentException if the fielddata is not supported on this type. * An IllegalArgumentException is needed in order to return an http error 400 * when this error occurs in a request. see: {@link org.elasticsearch.ExceptionsHelper#status} * * @param fullyQualifiedIndexName the name of the index this field-data is build for * */ public IndexFieldData.Builder fielddataBuilder(String fullyQualifiedIndexName) { throw new IllegalArgumentException("Fielddata is not supported on field [" + name() + "] of type [" + typeName() + "]"); }
@Override protected void validateReferences(Version indexVersionCreated, Function<String, MappedFieldType> fieldResolver) { if (fieldName != null) { MappedFieldType mappedFieldType = fieldResolver.apply(fieldName); if (mappedFieldType == null) { DEPRECATION_LOGGER.deprecatedAndMaybeLog("geo_context_mapping", "field [{}] referenced in context [{}] is not defined in the mapping", fieldName, name); } else if (GeoPointFieldMapper.CONTENT_TYPE.equals(mappedFieldType.typeName()) == false) { DEPRECATION_LOGGER.deprecatedAndMaybeLog("geo_context_mapping", "field [{}] referenced in context [{}] must be mapped to geo_point, found [{}]", fieldName, name, mappedFieldType.typeName()); } } }
/** Return a {@link DocValueFormat} that can be used to display and parse * values as returned by the fielddata API. * The default implementation returns a {@link DocValueFormat#RAW}. */ public DocValueFormat docValueFormat(@Nullable String format, DateTimeZone timeZone) { if (format != null) { throw new IllegalArgumentException("Field [" + name() + "] of type [" + typeName() + "] does not support custom formats"); } if (timeZone != null) { throw new IllegalArgumentException("Field [" + name() + "] of type [" + typeName() + "] does not support custom time zones"); } return DocValueFormat.RAW; }
/** @throws IllegalArgumentException if the fielddata is not supported on this type. * An IllegalArgumentException is needed in order to return an http error 400 * when this error occurs in a request. see: {@link org.elasticsearch.ExceptionsHelper#status} **/ protected final void failIfNoDocValues() { if (hasDocValues() == false) { throw new IllegalArgumentException("Can't load fielddata on [" + name() + "] because fielddata is unsupported on fields of type [" + typeName() + "]. Use doc values instead."); } }
public Query regexpQuery(String value, int flags, int maxDeterminizedStates, @Nullable MultiTermQuery.RewriteMethod method, QueryShardContext context) { throw new QueryShardException(context, "Can only use regexp queries on keyword and text fields - not on [" + name + "] which is of type [" + typeName() + "]"); }
public Query wildcardQuery(String value, @Nullable MultiTermQuery.RewriteMethod method, QueryShardContext context) { throw new QueryShardException(context, "Can only use wildcard queries on keyword and text fields - not on [" + name + "] which is of type [" + typeName() + "]"); }
public Query prefixQuery(String value, @Nullable MultiTermQuery.RewriteMethod method, QueryShardContext context) { throw new QueryShardException(context, "Can only use prefix queries on keyword and text fields - not on [" + name + "] which is of type [" + typeName() + "]"); }
private ValuesSource.GeoPoint geoPointField() throws IOException { if (!(fieldContext().indexFieldData() instanceof IndexGeoPointFieldData)) { throw new IllegalArgumentException("Expected geo_point type on field [" + fieldContext().field() + "], but got [" + fieldContext().fieldType().typeName() + "]"); } return new ValuesSource.GeoPoint.Fielddata((IndexGeoPointFieldData) fieldContext().indexFieldData()); } }
/** * Parse the field value using the provided {@link ParseContext}. */ public void parse(ParseContext context) throws IOException { final List<IndexableField> fields = new ArrayList<>(2); try { parseCreateField(context, fields); for (IndexableField field : fields) { context.doc().add(field); } } catch (Exception e) { throw new MapperParsingException("failed to parse field [{}] of type [{}]", e, fieldType().name(), fieldType().typeName()); } multiFields.parse(this, context); }
private ValuesSource.Numeric numericField() throws IOException { if (!(fieldContext().indexFieldData() instanceof IndexNumericFieldData)) { throw new IllegalArgumentException("Expected numeric type on field [" + fieldContext().field() + "], but got [" + fieldContext().fieldType().typeName() + "]"); } ValuesSource.Numeric dataSource = new ValuesSource.Numeric.FieldData((IndexNumericFieldData)fieldContext().indexFieldData()); if (script() != null) { dataSource = new ValuesSource.Numeric.WithScript(dataSource, script()); } return dataSource; }
throw new QueryShardException(context, "failed to find geo_shape field [" + fieldName + "]"); } else if (fieldType.typeName().equals(BaseGeoShapeFieldMapper.CONTENT_TYPE) == false) { throw new QueryShardException(context, "Field [" + fieldName + "] is not of type [geo_shape] but of type [" + fieldType.typeName() + "]");
builder = context.root().findTemplateBuilder(context, currentFieldName, "keyword", XContentFieldType.STRING); } else { switch (fieldType.typeName()) { case DateFieldMapper.CONTENT_TYPE: builder = context.root().findTemplateBuilder(context, currentFieldName, XContentFieldType.DATE); Mapper.TypeParser typeParser = parserContext.typeParser(fieldType.typeName()); if (typeParser == null) { throw new MapperParsingException("Cannot generate dynamic mappings of type [" + fieldType.typeName() + "] for [" + currentFieldName + "]");