org.elasticsearch.index.mapper.xcontent
Class XContentDocumentMapper

java.lang.Object
  extended by org.elasticsearch.index.mapper.xcontent.XContentDocumentMapper
All Implemented Interfaces:
DocumentMapper, ToXContent

public class XContentDocumentMapper
extends java.lang.Object
implements DocumentMapper, ToXContent


Nested Class Summary
static class XContentDocumentMapper.Builder
           
 
Nested classes/interfaces inherited from interface org.elasticsearch.index.mapper.DocumentMapper
DocumentMapper.MergeFlags, DocumentMapper.MergeResult, DocumentMapper.ParseListener<ParseContext>, DocumentMapper.ParseListenerAdapter
 
Nested classes/interfaces inherited from interface org.elasticsearch.util.xcontent.ToXContent
ToXContent.MapParams, ToXContent.Params
 
Field Summary
 
Fields inherited from interface org.elasticsearch.util.xcontent.ToXContent
EMPTY_PARAMS
 
Constructor Summary
XContentDocumentMapper(XContentObjectMapper rootObjectMapper, XContentUidFieldMapper uidFieldMapper, XContentIdFieldMapper idFieldMapper, XContentTypeFieldMapper typeFieldMapper, XContentSourceFieldMapper sourceFieldMapper, XContentAllFieldMapper allFieldMapper, org.apache.lucene.analysis.Analyzer indexAnalyzer, org.apache.lucene.analysis.Analyzer searchAnalyzer, XContentBoostFieldMapper boostFieldMapper, java.lang.String mappingSource)
           
 
Method Summary
 void addFieldMapperListener(FieldMapperListener fieldMapperListener, boolean includeExisting)
          Adds a field mapper listener.
 AllFieldMapper allFieldMapper()
           
 BoostFieldMapper boostMapper()
           
 java.lang.String buildSource()
          Generates the source of the mapper based on the current mappings.
 IdFieldMapper idMapper()
           
 org.apache.lucene.analysis.Analyzer indexAnalyzer()
          The default index analyzer to be used.
 DocumentFieldMappers mappers()
           
 java.lang.String mappingSource()
          When constructed by parsing a mapping definition, will return it.
 DocumentMapper.MergeResult merge(DocumentMapper mergeWith, DocumentMapper.MergeFlags mergeFlags)
          Merges this document mapper with the provided document mapper.
 ParsedDocument parse(byte[] source)
          Parses the source into the parsed document.
 ParsedDocument parse(java.lang.String type, java.lang.String id, byte[] source)
          Parses the source into a parsed document.
 ParsedDocument parse(java.lang.String type, java.lang.String id, byte[] source, DocumentMapper.ParseListener listener)
          Parses the source into a parsed document.
 org.apache.lucene.analysis.Analyzer searchAnalyzer()
          The default search analyzer to be used.
 SourceFieldMapper sourceMapper()
           
 void toXContent(XContentBuilder builder, ToXContent.Params params)
           
 java.lang.String type()
           
 TypeFieldMapper typeMapper()
           
 UidFieldMapper uidMapper()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XContentDocumentMapper

public XContentDocumentMapper(XContentObjectMapper rootObjectMapper,
                              XContentUidFieldMapper uidFieldMapper,
                              XContentIdFieldMapper idFieldMapper,
                              XContentTypeFieldMapper typeFieldMapper,
                              XContentSourceFieldMapper sourceFieldMapper,
                              XContentAllFieldMapper allFieldMapper,
                              org.apache.lucene.analysis.Analyzer indexAnalyzer,
                              org.apache.lucene.analysis.Analyzer searchAnalyzer,
                              @Nullable
                              XContentBoostFieldMapper boostFieldMapper,
                              @Nullable
                              java.lang.String mappingSource)
Method Detail

type

public java.lang.String type()
Specified by:
type in interface DocumentMapper

mappingSource

public java.lang.String mappingSource()
Description copied from interface: DocumentMapper
When constructed by parsing a mapping definition, will return it. Otherwise, returns null.

Specified by:
mappingSource in interface DocumentMapper

uidMapper

public UidFieldMapper uidMapper()
Specified by:
uidMapper in interface DocumentMapper

idMapper

public IdFieldMapper idMapper()
Specified by:
idMapper in interface DocumentMapper

typeMapper

public TypeFieldMapper typeMapper()
Specified by:
typeMapper in interface DocumentMapper

sourceMapper

public SourceFieldMapper sourceMapper()
Specified by:
sourceMapper in interface DocumentMapper

boostMapper

public BoostFieldMapper boostMapper()
Specified by:
boostMapper in interface DocumentMapper

allFieldMapper

public AllFieldMapper allFieldMapper()
Specified by:
allFieldMapper in interface DocumentMapper

indexAnalyzer

public org.apache.lucene.analysis.Analyzer indexAnalyzer()
Description copied from interface: DocumentMapper
The default index analyzer to be used. Note, the DocumentFieldMappers.indexAnalyzer() should probably be used instead.

Specified by:
indexAnalyzer in interface DocumentMapper

searchAnalyzer

public org.apache.lucene.analysis.Analyzer searchAnalyzer()
Description copied from interface: DocumentMapper
The default search analyzer to be used. Note, the DocumentFieldMappers.searchAnalyzer() should probably be used instead.

Specified by:
searchAnalyzer in interface DocumentMapper

mappers

public DocumentFieldMappers mappers()
Specified by:
mappers in interface DocumentMapper

parse

public ParsedDocument parse(byte[] source)
Description copied from interface: DocumentMapper
Parses the source into the parsed document.

Specified by:
parse in interface DocumentMapper

parse

public ParsedDocument parse(@Nullable
                            java.lang.String type,
                            @Nullable
                            java.lang.String id,
                            byte[] source)
                     throws MapperParsingException
Description copied from interface: DocumentMapper
Parses the source into a parsed document.

Validates that the source has the provided id and type. Note, most times we will already have the id and the type even though they exist in the source as well.

Specified by:
parse in interface DocumentMapper
Throws:
MapperParsingException

parse

public ParsedDocument parse(java.lang.String type,
                            java.lang.String id,
                            byte[] source,
                            DocumentMapper.ParseListener listener)
Description copied from interface: DocumentMapper
Parses the source into a parsed document.

Validates that the source has the provided id and type. Note, most times we will already have the id and the type even though they exist in the source as well.

Specified by:
parse in interface DocumentMapper

addFieldMapperListener

public void addFieldMapperListener(FieldMapperListener fieldMapperListener,
                                   boolean includeExisting)
Description copied from interface: DocumentMapper
Adds a field mapper listener.

Specified by:
addFieldMapperListener in interface DocumentMapper

merge

public DocumentMapper.MergeResult merge(DocumentMapper mergeWith,
                                        DocumentMapper.MergeFlags mergeFlags)
Description copied from interface: DocumentMapper
Merges this document mapper with the provided document mapper. If there are conflicts, the DocumentMapper.MergeResult will hold them.

Specified by:
merge in interface DocumentMapper

buildSource

public java.lang.String buildSource()
                             throws FailedToGenerateSourceMapperException
Description copied from interface: DocumentMapper
Generates the source of the mapper based on the current mappings.

Specified by:
buildSource in interface DocumentMapper
Throws:
FailedToGenerateSourceMapperException

toXContent

public void toXContent(XContentBuilder builder,
                       ToXContent.Params params)
                throws java.io.IOException
Specified by:
toXContent in interface ToXContent
Throws:
java.io.IOException