Class ContextMapping<T extends org.elasticsearch.common.xcontent.ToXContent>
org.elasticsearch.search.suggest.completion.context.ContextMapping<T>
- All Implemented Interfaces:
org.elasticsearch.common.xcontent.ToXContent
,org.elasticsearch.common.xcontent.ToXContentFragment
- Direct Known Subclasses:
CategoryContextMapping
,GeoContextMapping
public abstract class ContextMapping<T extends org.elasticsearch.common.xcontent.ToXContent>
extends
implements org.elasticsearch.common.xcontent.ToXContentFragment
A
ContextMapping
defines criteria that can be used to
filter and/or boost suggestions at query time for CompletionFieldMapper
.
Implementations have to define how contexts are parsed at query/index time-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static class
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 inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS
-
Constructor Summary
ModifierConstructorDescriptionprotected
ContextMapping(ContextMapping.Type type, name)
Define a new context mapping of a specific type -
Method Summary
Modifier and TypeMethodDescriptionboolean
o)
protected abstract T
fromXContent(org.elasticsearch.common.xcontent.XContentParser context)
Prototype for the query contextint
hashCode()
name()
protected abstract <>
parseContext(LuceneDocument document)
Retrieves a set of context from adocument
at index-time.abstract <>
parseContext(ParseContext parseContext, org.elasticsearch.common.xcontent.XContentParser parser)
Parses a set of index-time contexts.parseQueryContext(org.elasticsearch.common.xcontent.XContentParser parser)
Parses query contexts for this mapperprotected abstract org.elasticsearch.common.xcontent.XContentBuilder
toInnerXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params)
Implementations should add specific configurations that need to be persistedprotected abstract <ContextMapping.InternalQueryContext>
<T> queryContexts)
Convert query contexts to common representationtoString()
org.elasticsearch.common.xcontent.XContentBuilder
toXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params)
type()
void
validateReferences(Version indexVersionCreated, <,MappedFieldType> fieldResolver)
Checks if the current context is consistent with the rest of the fields.Methods inherited from class java.lang.
, , , , , , ,
Methods inherited from interface org.elasticsearch.common.xcontent.ToXContentFragment
isFragment
-
Field Details
-
FIELD_TYPE
public static final FIELD_TYPE- See Also:
- Constant Field Values
-
FIELD_NAME
public static final FIELD_NAME- See Also:
- Constant Field Values
-
type
-
name
protected final name
-
-
Constructor Details
-
ContextMapping
Define a new context mapping of a specific type- Parameters:
type
- type of context mapping, eitherContextMapping.Type.CATEGORY
orContextMapping.Type.GEO
name
- name of context mapping
-
-
Method Details
-
type
- Returns:
- the type name of the context
-
name
public name()- Returns:
- the name/id of the context
-
parseContext
public abstract <> parseContext(ParseContext parseContext, org.elasticsearch.common.xcontent.XContentParser parser) throws , ElasticsearchParseExceptionParses a set of index-time contexts.- Throws:
ElasticsearchParseException
-
parseContext
Retrieves a set of context from adocument
at index-time. -
fromXContent
Prototype for the query context- Throws:
-
parseQueryContext
public final <ContextMapping.InternalQueryContext> parseQueryContext(org.elasticsearch.common.xcontent.XContentParser parser) throws , ElasticsearchParseExceptionParses query contexts for this mapper- Throws:
ElasticsearchParseException
-
toInternalQueryContexts
protected abstract <<T> queryContexts)Convert query contexts to common representation -
toInnerXContent
protected abstract org.elasticsearch.common.xcontent.XContentBuilder toInnerXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throwsImplementations should add specific configurations that need to be persisted- Throws:
-
validateReferences
Checks if the current context is consistent with the rest of the fields. For example, the GeoContext should check that the field that it points to has the correct type. -
toXContent
public final org.elasticsearch.common.xcontent.XContentBuilder toXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws- Specified by:
toXContent
in interfaceorg.elasticsearch.common.xcontent.ToXContent
- Throws:
-
equals
public boolean equals( o)- Overrides:
in class
-
hashCode
public int hashCode()- Overrides:
in class
-
toString
public toString()- Overrides:
in class
-