Class ParentJoinFieldMapper

  • All Implemented Interfaces:
    java.lang.Cloneable, java.lang.Iterable<org.elasticsearch.index.mapper.Mapper>, org.elasticsearch.common.xcontent.ToXContent, org.elasticsearch.common.xcontent.ToXContentFragment

    public final class ParentJoinFieldMapper
    extends org.elasticsearch.index.mapper.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

        org.elasticsearch.index.mapper.FieldMapper.CopyTo, org.elasticsearch.index.mapper.FieldMapper.MultiFields
      • Nested classes/interfaces inherited from class org.elasticsearch.index.mapper.Mapper

        org.elasticsearch.index.mapper.Mapper.BuilderContext
      • 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 
      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
      • Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent

        EMPTY_PARAMS
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected ParentJoinFieldMapper​(java.lang.String simpleName, org.elasticsearch.index.mapper.MappedFieldType fieldType, org.elasticsearch.common.settings.Settings indexSettings, MetaJoinFieldMapper uniqueFieldMapper, java.util.List<ParentIdFieldMapper> parentIdFields, boolean eagerGlobalOrdinals)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected ParentJoinFieldMapper clone()  
      protected java.lang.String contentType()  
      protected void doMerge​(org.elasticsearch.index.mapper.Mapper mergeWith, boolean updateAllTypes)  
      protected void doXContentBody​(org.elasticsearch.common.xcontent.XContentBuilder builder, boolean includeDefaults, org.elasticsearch.common.xcontent.ToXContent.Params params)  
      ParentJoinFieldMapper.JoinFieldType fieldType()  
      static ParentJoinFieldMapper getMapper​(org.elasticsearch.index.mapper.MapperService service)
      Returns the ParentJoinFieldMapper associated with the service 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 parent name if isParent is true and a child name otherwise.
      boolean hasChild​(java.lang.String name)
      Returns true if name is a child name in the field.
      boolean hasParent​(java.lang.String name)
      Returns true if name is a parent name in the field.
      java.util.Iterator<org.elasticsearch.index.mapper.Mapper> iterator()  
      org.elasticsearch.index.mapper.Mapper parse​(org.elasticsearch.index.mapper.ParseContext context)  
      protected void parseCreateField​(org.elasticsearch.index.mapper.ParseContext context, java.util.List<org.apache.lucene.index.IndexableField> fields)  
      org.elasticsearch.index.mapper.FieldMapper updateFieldType​(java.util.Map<java.lang.String,org.elasticsearch.index.mapper.MappedFieldType> fullNameToFieldType)  
      • Methods inherited from class org.elasticsearch.index.mapper.FieldMapper

        copyTo, createFieldNamesField, doXContentAnalyzers, doXContentDocValues, indexOptionToString, merge, name, termVectorOptionsToString, toXContent, typeName
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
      • Methods inherited from class org.elasticsearch.index.mapper.Mapper

        simpleName
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface org.elasticsearch.common.xcontent.ToXContentFragment

        isFragment
    • Constructor Detail

      • ParentJoinFieldMapper

        protected ParentJoinFieldMapper​(java.lang.String simpleName,
                                        org.elasticsearch.index.mapper.MappedFieldType fieldType,
                                        org.elasticsearch.common.settings.Settings indexSettings,
                                        MetaJoinFieldMapper uniqueFieldMapper,
                                        java.util.List<ParentIdFieldMapper> parentIdFields,
                                        boolean eagerGlobalOrdinals)
    • Method Detail

      • getMapper

        public static ParentJoinFieldMapper getMapper​(org.elasticsearch.index.mapper.MapperService service)
        Returns the ParentJoinFieldMapper associated with the service or null if there is no parent-join field in this mapping.
      • contentType

        protected java.lang.String contentType()
        Specified by:
        contentType in class org.elasticsearch.index.mapper.FieldMapper
      • clone

        protected ParentJoinFieldMapper clone()
        Overrides:
        clone in class org.elasticsearch.index.mapper.FieldMapper
      • iterator

        public java.util.Iterator<org.elasticsearch.index.mapper.Mapper> iterator()
        Specified by:
        iterator in interface java.lang.Iterable<org.elasticsearch.index.mapper.Mapper>
        Overrides:
        iterator in class org.elasticsearch.index.mapper.FieldMapper
      • hasParent

        public boolean hasParent​(java.lang.String name)
        Returns true if name is a parent name in the field.
      • hasChild

        public boolean hasChild​(java.lang.String name)
        Returns true if name is a child name in the field.
      • getParentIdFieldMapper

        public ParentIdFieldMapper getParentIdFieldMapper​(java.lang.String name,
                                                          boolean isParent)
        Returns the parent Id field mapper associated with a parent name if isParent is true and a child name otherwise.
      • doMerge

        protected void doMerge​(org.elasticsearch.index.mapper.Mapper mergeWith,
                               boolean updateAllTypes)
        Overrides:
        doMerge in class org.elasticsearch.index.mapper.FieldMapper
      • updateFieldType

        public org.elasticsearch.index.mapper.FieldMapper updateFieldType​(java.util.Map<java.lang.String,org.elasticsearch.index.mapper.MappedFieldType> fullNameToFieldType)
        Overrides:
        updateFieldType in class org.elasticsearch.index.mapper.FieldMapper
      • parseCreateField

        protected void parseCreateField​(org.elasticsearch.index.mapper.ParseContext context,
                                        java.util.List<org.apache.lucene.index.IndexableField> fields)
                                 throws java.io.IOException
        Specified by:
        parseCreateField in class org.elasticsearch.index.mapper.FieldMapper
        Throws:
        java.io.IOException
      • parse

        public org.elasticsearch.index.mapper.Mapper parse​(org.elasticsearch.index.mapper.ParseContext context)
                                                    throws java.io.IOException
        Overrides:
        parse in class org.elasticsearch.index.mapper.FieldMapper
        Throws:
        java.io.IOException
      • doXContentBody

        protected void doXContentBody​(org.elasticsearch.common.xcontent.XContentBuilder builder,
                                      boolean includeDefaults,
                                      org.elasticsearch.common.xcontent.ToXContent.Params params)
                               throws java.io.IOException
        Overrides:
        doXContentBody in class org.elasticsearch.index.mapper.FieldMapper
        Throws:
        java.io.IOException