Package org.elasticsearch.join.mapper
Class ParentJoinFieldMapper
java.lang.Object
org.elasticsearch.index.mapper.Mapper
org.elasticsearch.index.mapper.FieldMapper
org.elasticsearch.join.mapper.ParentJoinFieldMapper
- All Implemented Interfaces:
java.lang.Cloneable
,java.lang.Iterable<Mapper>
,ToXContent
,ToXContentFragment
public final class ParentJoinFieldMapper extends FieldMapper
A
FieldMapper
that creates hierarchical joins (parent-join) between documents in the same index.
Only one parent-join field can be defined per index. The verification of this assumption is done
through the MetaJoinFieldMapper
which declares a meta field called "_parent_join".
This field is only used to ensure that there is a single parent-join field defined in the mapping and
cannot be used to index or query any data.-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ParentJoinFieldMapper.Builder
static class
ParentJoinFieldMapper.Defaults
static class
ParentJoinFieldMapper.JoinFieldType
static class
ParentJoinFieldMapper.TypeParser
Nested classes/interfaces inherited from class org.elasticsearch.index.mapper.FieldMapper
FieldMapper.CopyTo, FieldMapper.MultiFields
Nested classes/interfaces inherited from class org.elasticsearch.index.mapper.Mapper
Mapper.BuilderContext
Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
CONTENT_TYPE
static java.lang.String
NAME
Fields inherited from class org.elasticsearch.index.mapper.FieldMapper
COERCE_SETTING, copyTo, defaultFieldType, fieldType, IGNORE_MALFORMED_SETTING, indexCreatedVersion, multiFields
-
Constructor Summary
Constructors Modifier Constructor Description protected
ParentJoinFieldMapper(java.lang.String simpleName, MappedFieldType fieldType, Settings indexSettings, MetaJoinFieldMapper uniqueFieldMapper, java.util.List<ParentIdFieldMapper> parentIdFields, boolean eagerGlobalOrdinals)
-
Method Summary
Modifier and Type Method Description protected ParentJoinFieldMapper
clone()
protected java.lang.String
contentType()
protected void
doMerge(Mapper mergeWith)
protected void
doXContentBody(XContentBuilder builder, boolean includeDefaults, ToXContent.Params params)
ParentJoinFieldMapper.JoinFieldType
fieldType()
static ParentJoinFieldMapper
getMapper(MapperService service)
Returns theParentJoinFieldMapper
associated with theservice
or null if there is no parent-join field in this mapping.ParentIdFieldMapper
getParentIdFieldMapper(java.lang.String name, boolean isParent)
Returns the parent Id field mapper associated with a parentname
ifisParent
is true and a childname
otherwise.boolean
hasChild(java.lang.String name)
Returns true ifname
is a child name in the field.boolean
hasParent(java.lang.String name)
Returns true ifname
is a parent name in the field.java.util.Iterator<Mapper>
iterator()
void
parse(ParseContext context)
protected void
parseCreateField(ParseContext context, java.util.List<IndexableField> fields)
FieldMapper
updateFieldType(java.util.Map<java.lang.String,MappedFieldType> fullNameToFieldType)
Methods inherited from class org.elasticsearch.index.mapper.FieldMapper
copyTo, createFieldNamesField, doXContentAnalyzers, doXContentDocValues, indexOptionToString, merge, name, parsesArrayValue, termVectorOptionsToString, toXContent, typeName
-
Field Details
-
NAME
public static final java.lang.String NAME- See Also:
- Constant Field Values
-
CONTENT_TYPE
public static final java.lang.String CONTENT_TYPE- See Also:
- Constant Field Values
-
-
Constructor Details
-
ParentJoinFieldMapper
protected ParentJoinFieldMapper(java.lang.String simpleName, MappedFieldType fieldType, Settings indexSettings, MetaJoinFieldMapper uniqueFieldMapper, java.util.List<ParentIdFieldMapper> parentIdFields, boolean eagerGlobalOrdinals)
-
-
Method Details
-
getMapper
Returns theParentJoinFieldMapper
associated with theservice
or null if there is no parent-join field in this mapping. -
contentType
protected java.lang.String contentType()- Specified by:
contentType
in classFieldMapper
-
clone
- Overrides:
clone
in classFieldMapper
-
fieldType
- Overrides:
fieldType
in classFieldMapper
-
iterator
- Specified by:
iterator
in interfacejava.lang.Iterable<Mapper>
- Overrides:
iterator
in classFieldMapper
-
hasParent
public boolean hasParent(java.lang.String name)Returns true ifname
is a parent name in the field. -
hasChild
public boolean hasChild(java.lang.String name)Returns true ifname
is a child name in the field. -
getParentIdFieldMapper
Returns the parent Id field mapper associated with a parentname
ifisParent
is true and a childname
otherwise. -
doMerge
- Overrides:
doMerge
in classFieldMapper
-
updateFieldType
public FieldMapper updateFieldType(java.util.Map<java.lang.String,MappedFieldType> fullNameToFieldType)- Overrides:
updateFieldType
in classFieldMapper
-
parseCreateField
protected void parseCreateField(ParseContext context, java.util.List<IndexableField> fields) throws java.io.IOException- Specified by:
parseCreateField
in classFieldMapper
- Throws:
java.io.IOException
-
parse
- Overrides:
parse
in classFieldMapper
- Throws:
java.io.IOException
-
doXContentBody
protected void doXContentBody(XContentBuilder builder, boolean includeDefaults, ToXContent.Params params) throws java.io.IOException- Overrides:
doXContentBody
in classFieldMapper
- Throws:
java.io.IOException
-