org.elasticsearch.index.mapper.xcontent
Class XContentDocumentMapper

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

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.common.xcontent.ToXContent
ToXContent.MapParams, ToXContent.Params
 
Field Summary
 
Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS
 
Constructor Summary
XContentDocumentMapper(java.lang.String index, XContentDocumentMapperParser docMapperParser, RootObjectMapper rootObjectMapper, org.elasticsearch.common.collect.ImmutableMap<java.lang.String,java.lang.Object> meta, UidFieldMapper uidFieldMapper, IdFieldMapper idFieldMapper, TypeFieldMapper typeFieldMapper, IndexFieldMapper indexFieldMapper, SourceFieldMapper sourceFieldMapper, RoutingFieldMapper routingFieldMapper, AllFieldMapper allFieldMapper, AnalyzerMapper analyzerMapper, NamedAnalyzer indexAnalyzer, NamedAnalyzer searchAnalyzer, BoostFieldMapper boostFieldMapper)
           
 
Method Summary
 void addFieldMapperListener(FieldMapperListener fieldMapperListener, boolean includeExisting)
          Adds a field mapper listener.
 AllFieldMapper allFieldMapper()
           
 BoostFieldMapper boostMapper()
           
 IdFieldMapper idMapper()
           
 org.apache.lucene.analysis.Analyzer indexAnalyzer()
          The default index analyzer to be used.
 IndexFieldMapper indexMapper()
           
 DocumentFieldMappers mappers()
           
 CompressedString 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.
 org.elasticsearch.common.collect.ImmutableMap<java.lang.String,java.lang.Object> meta()
          Attributes of this type mappings.
 ParsedDocument parse(byte[] source)
          Parses the source into a parsed document.
 ParsedDocument parse(SourceToParse source)
          Parses the source into a parsed document.
 ParsedDocument parse(SourceToParse source, DocumentMapper.ParseListener listener)
          Parses the source into a parsed document.
 ParsedDocument parse(java.lang.String type, java.lang.String id, byte[] source)
          Parses the source into a parsed document.
 void refreshSource()
          Generates the source of the mapper based on the current mappings.
 RootObjectMapper root()
           
 RoutingFieldMapper routingFieldMapper()
           
 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()
           
 org.apache.lucene.search.Filter typeFilter()
          A filter based on the type of the field.
 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(java.lang.String index,
                              XContentDocumentMapperParser docMapperParser,
                              RootObjectMapper rootObjectMapper,
                              org.elasticsearch.common.collect.ImmutableMap<java.lang.String,java.lang.Object> meta,
                              UidFieldMapper uidFieldMapper,
                              IdFieldMapper idFieldMapper,
                              TypeFieldMapper typeFieldMapper,
                              IndexFieldMapper indexFieldMapper,
                              SourceFieldMapper sourceFieldMapper,
                              RoutingFieldMapper routingFieldMapper,
                              AllFieldMapper allFieldMapper,
                              AnalyzerMapper analyzerMapper,
                              NamedAnalyzer indexAnalyzer,
                              NamedAnalyzer searchAnalyzer,
                              @Nullable
                              BoostFieldMapper boostFieldMapper)
Method Detail

type

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

meta

public org.elasticsearch.common.collect.ImmutableMap<java.lang.String,java.lang.Object> meta()
Description copied from interface: DocumentMapper
Attributes of this type mappings.

Specified by:
meta in interface DocumentMapper

mappingSource

public CompressedString 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

root

public RootObjectMapper root()

uidMapper

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

idMapper

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

indexMapper

public IndexFieldMapper indexMapper()
Specified by:
indexMapper 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

routingFieldMapper

public RoutingFieldMapper routingFieldMapper()
Specified by:
routingFieldMapper 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

typeFilter

public org.apache.lucene.search.Filter typeFilter()
Description copied from interface: DocumentMapper
A filter based on the type of the field.

Specified by:
typeFilter in interface DocumentMapper

mappers

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

parse

public ParsedDocument parse(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)
                     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(SourceToParse 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(SourceToParse source,
                            @Nullable
                            DocumentMapper.ParseListener listener)
                     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

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

refreshSource

public void refreshSource()
                   throws FailedToGenerateSourceMapperException
Description copied from interface: DocumentMapper
Generates the source of the mapper based on the current mappings.

Specified by:
refreshSource 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