org.elasticsearch.index.mapper
Class MapperService

java.lang.Object
  extended by org.elasticsearch.index.AbstractIndexComponent
      extended by org.elasticsearch.index.mapper.MapperService
All Implemented Interfaces:
Iterable<DocumentMapper>, IndexComponent

public class MapperService
extends AbstractIndexComponent
implements Iterable<DocumentMapper>


Nested Class Summary
static class MapperService.SmartNameFieldMappers
           
static class MapperService.SmartNameObjectMapper
           
 
Field Summary
static String DEFAULT_MAPPING
           
 
Fields inherited from class org.elasticsearch.index.AbstractIndexComponent
componentSettings, index, indexSettings, logger
 
Constructor Summary
MapperService(Index index, Settings indexSettings, Environment environment, AnalysisService analysisService)
           
 
Method Summary
 void add(String type, String mappingSource)
           
 AnalysisService analysisService()
           
 void close()
           
 DocumentMapper documentMapper(String type)
           
 DocumentMapperParser documentMapperParser()
           
 DocumentMapper documentMapperWithAutoCreate(String type)
           
 FieldMappers fullName(String fullName)
          Returns the FieldMappers of all the FieldMappers that are registered under the give fullName across all the different DocumentMapper types.
 boolean hasMapping(String mappingType)
           
 boolean hasNested()
           
 FieldMappers indexName(String indexName)
          Returns FieldMappers for all the FieldMappers that are registered under the given indexName across all the different DocumentMapper types.
 com.google.common.collect.UnmodifiableIterator<DocumentMapper> iterator()
           
 FieldMappers name(String name)
          Returns FieldMappers for all the FieldMappers that are registered under the given name across all the different DocumentMapper types.
 ObjectMappers objectMapper(String path)
          Returns objects mappers based on the full path of the object.
 DocumentMapper parse(String mappingType, String mappingSource)
          Just parses and returns the mapper without adding it.
 void remove(String type)
           
 org.apache.lucene.analysis.Analyzer searchAnalyzer()
           
 org.apache.lucene.search.Filter searchFilter(String... types)
          A filter for search.
 org.apache.lucene.analysis.Analyzer searchQuoteAnalyzer()
           
 Set<String> simpleMatchToIndexNames(String pattern)
           
 MapperService.SmartNameFieldMappers smartName(String smartName)
          Returns smart field mappers based on a smart name.
 MapperService.SmartNameFieldMappers smartName(String smartName, String[] types)
           
 FieldMapper smartNameFieldMapper(String smartName)
          Same as smartNameFieldMappers(String) but returns the first field mapper for it.
 FieldMapper smartNameFieldMapper(String smartName, String[] types)
           
 FieldMappers smartNameFieldMappers(String smartName)
          Same as smartName(String), except it returns just the field mappers.
 FieldMappers smartNameFieldMappers(String smartName, String[] types)
           
 MapperService.SmartNameObjectMapper smartNameObjectMapper(String smartName)
           
 MapperService.SmartNameObjectMapper smartNameObjectMapper(String smartName, String[] types)
           
 Collection<String> types()
           
 
Methods inherited from class org.elasticsearch.index.AbstractIndexComponent
index, nodeName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_MAPPING

public static final String DEFAULT_MAPPING
See Also:
Constant Field Values
Constructor Detail

MapperService

@Inject
public MapperService(Index index,
                            @IndexSettings
                            Settings indexSettings,
                            Environment environment,
                            AnalysisService analysisService)
Method Detail

close

public void close()

hasNested

public boolean hasNested()

iterator

public com.google.common.collect.UnmodifiableIterator<DocumentMapper> iterator()
Specified by:
iterator in interface Iterable<DocumentMapper>

analysisService

public AnalysisService analysisService()

documentMapperParser

public DocumentMapperParser documentMapperParser()

add

public void add(String type,
                String mappingSource)

remove

public void remove(String type)

parse

public DocumentMapper parse(String mappingType,
                            String mappingSource)
                     throws MapperParsingException
Just parses and returns the mapper without adding it.

Throws:
MapperParsingException

hasMapping

public boolean hasMapping(String mappingType)

types

public Collection<String> types()

documentMapper

public DocumentMapper documentMapper(String type)

documentMapperWithAutoCreate

public DocumentMapper documentMapperWithAutoCreate(String type)

searchFilter

@Nullable
public org.apache.lucene.search.Filter searchFilter(String... types)
A filter for search. If a filter is required, will return it, otherwise, will return null.


name

public FieldMappers name(String name)
Returns FieldMappers for all the FieldMappers that are registered under the given name across all the different DocumentMapper types.

Parameters:
name - The name to return all the FieldMappers for across all DocumentMappers.
Returns:
All the FieldMappers for across all DocumentMappers

indexName

public FieldMappers indexName(String indexName)
Returns FieldMappers for all the FieldMappers that are registered under the given indexName across all the different DocumentMapper types.

Parameters:
indexName - The indexName to return all the FieldMappers for across all DocumentMappers.
Returns:
All the FieldMappers across all DocumentMappers for the given indexName.

fullName

public FieldMappers fullName(String fullName)
Returns the FieldMappers of all the FieldMappers that are registered under the give fullName across all the different DocumentMapper types.

Parameters:
fullName - The full name
Returns:
All teh FieldMappers across all the DocumentMappers for the given fullName.

objectMapper

public ObjectMappers objectMapper(String path)
Returns objects mappers based on the full path of the object.


simpleMatchToIndexNames

public Set<String> simpleMatchToIndexNames(String pattern)

smartNameObjectMapper

public MapperService.SmartNameObjectMapper smartNameObjectMapper(String smartName,
                                                                 @Nullable
                                                                 String[] types)

smartNameObjectMapper

public MapperService.SmartNameObjectMapper smartNameObjectMapper(String smartName)

smartNameFieldMapper

public FieldMapper smartNameFieldMapper(String smartName)
Same as smartNameFieldMappers(String) but returns the first field mapper for it. Returns null if there is none.


smartNameFieldMapper

public FieldMapper smartNameFieldMapper(String smartName,
                                        @Nullable
                                        String[] types)

smartNameFieldMappers

public FieldMappers smartNameFieldMappers(String smartName,
                                          @Nullable
                                          String[] types)

smartNameFieldMappers

public FieldMappers smartNameFieldMappers(String smartName)
Same as smartName(String), except it returns just the field mappers.


smartName

public MapperService.SmartNameFieldMappers smartName(String smartName,
                                                     @Nullable
                                                     String[] types)

smartName

public MapperService.SmartNameFieldMappers smartName(String smartName)
Returns smart field mappers based on a smart name. A smart name is one that can optioannly be prefixed with a type (and then a '.'). If it is, then the MapperService.SmartNameFieldMappers will have the doc mapper set.

It also (without the optional type prefix) try and find the FieldMappers for the specific name. It will first try to find it based on the full name (with the dots if its a compound name). If it is not found, will try and find it based on the indexName (which can be controlled in the mapping), and last, will try it based no the name itself.

If nothing is found, returns null.


searchAnalyzer

public org.apache.lucene.analysis.Analyzer searchAnalyzer()

searchQuoteAnalyzer

public org.apache.lucene.analysis.Analyzer searchQuoteAnalyzer()


Copyright © 2009-2012. All Rights Reserved.