Package org.elasticsearch.index.mapper
Class DynamicKeyFieldMapper
java.lang.Object
org.elasticsearch.index.mapper.Mapper
org.elasticsearch.index.mapper.FieldMapper
org.elasticsearch.index.mapper.DynamicKeyFieldMapper
- All Implemented Interfaces:
java.lang.Cloneable
,java.lang.Iterable<Mapper>
,org.elasticsearch.common.xcontent.ToXContent
,org.elasticsearch.common.xcontent.ToXContentFragment
public abstract class DynamicKeyFieldMapper extends FieldMapper
A field mapper that supports lookup of dynamic sub-keys. If the field mapper is named 'my_field',
then a user is able to search on the field in both of the following ways:
- Using the field name 'my_field', which will delegate to the field type
FieldMapper.fieldType()
as usual.
- Using any sub-key, for example 'my_field.some_key'. In this case, the search is delegated
to keyedFieldType(String)
, with 'some_key' passed as the
argument. The field mapper is allowed to create a new field type dynamically in order
to handle the search.
To prevent conflicts between these dynamic sub-keys and multi-fields, any field mappers
implementing this interface should explicitly disallow multi-fields. The constructor makes
sure to passes an empty multi-fields list to help prevent conflicting sub-keys from being
registered.
Note: we anticipate that 'flattened' fields will be the only implementation of this
interface. Flattened object fields live in the 'mapper-flattened' module.-
Nested Class Summary
Nested classes/interfaces inherited from class org.elasticsearch.index.mapper.FieldMapper
FieldMapper.Builder, FieldMapper.Conflicts, FieldMapper.CopyTo, FieldMapper.MergeValidator<T>, FieldMapper.MultiFields, FieldMapper.Parameter<T>, FieldMapper.Serializer<T>, FieldMapper.SerializerCheck<T>, FieldMapper.TypeParser
Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent
org.elasticsearch.common.xcontent.ToXContent.DelegatingMapParams, org.elasticsearch.common.xcontent.ToXContent.MapParams, org.elasticsearch.common.xcontent.ToXContent.Params
-
Field Summary
Fields inherited from class org.elasticsearch.index.mapper.FieldMapper
COERCE_SETTING, copyTo, IGNORE_MALFORMED_SETTING, indexAnalyzers, mappedFieldType, multiFields
Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS
-
Constructor Summary
Constructors Constructor Description DynamicKeyFieldMapper(java.lang.String simpleName, MappedFieldType defaultFieldType, NamedAnalyzer indexAnalyzer, FieldMapper.CopyTo copyTo)
-
Method Summary
Modifier and Type Method Description abstract MappedFieldType
keyedFieldType(java.lang.String key)
Methods inherited from class org.elasticsearch.index.mapper.FieldMapper
checkIncomingMergeType, contentType, copyTo, createFieldNamesField, doValidate, doXContentBody, fieldType, getMergeBuilder, indexAnalyzers, iterator, merge, multiFields, name, parse, parseCreateField, parsesArrayValue, toXContent, typeName, validate
Methods inherited from class org.elasticsearch.index.mapper.Mapper
simpleName
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
Methods inherited from interface org.elasticsearch.common.xcontent.ToXContentFragment
isFragment
-
Constructor Details
-
DynamicKeyFieldMapper
public DynamicKeyFieldMapper(java.lang.String simpleName, MappedFieldType defaultFieldType, NamedAnalyzer indexAnalyzer, FieldMapper.CopyTo copyTo)
-
-
Method Details
-
keyedFieldType
-