public class CategoryContextMapping extends ContextMapping
CategoryContextMapping
is used to define a ContextMapping
that
references a field within a document. The value of the field in turn will be
used to setup the suggestions made by the completion suggester.Modifier and Type | Class and Description |
---|---|
static class |
CategoryContextMapping.Builder |
ContextMapping.Context, ContextMapping.ContextConfig, ContextMapping.ContextQuery
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
Modifier and Type | Field and Description |
---|---|
protected static String |
TYPE |
EMPTY_CONFIG, EMPTY_CONTEXT, EMPTY_MAPPING, FIELD_MISSING, FIELD_TYPE, FIELD_VALUE, name, SEPARATOR, type
EMPTY_PARAMS
Constructor and Description |
---|
CategoryContextMapping(String name)
Create a new
CategoryContextMapping with the default field
[_type] |
CategoryContextMapping(String name,
Iterable<? extends CharSequence> defaultValues)
Create a new
CategoryContextMapping with the default field
[_type] |
CategoryContextMapping(String name,
String fieldName)
Create a new
CategoryContextMapping with the default field
[_type] |
CategoryContextMapping(String name,
String fieldName,
Iterable<? extends CharSequence> defaultValues)
Create a new
CategoryContextMapping with the default field
[_type] |
Modifier and Type | Method and Description |
---|---|
org.elasticsearch.search.suggest.context.CategoryContextMapping.FieldConfig |
defaultConfig() |
boolean |
equals(Object obj) |
Iterable<? extends CharSequence> |
getDefaultValues() |
String |
getFieldName()
Name of the field used by this
CategoryContextMapping |
int |
hashCode() |
protected static CategoryContextMapping |
load(String name,
Map<String,Object> config)
Load the specification of a
CategoryContextMapping |
ContextMapping.ContextConfig |
parseContext(ParseContext parseContext,
XContentParser parser)
A
ContextMapping combined with the information provided by a document
form a ContextMapping.ContextConfig which is used to build the underlying FST. |
org.elasticsearch.search.suggest.context.CategoryContextMapping.FieldQuery |
parseQuery(String name,
XContentParser parser)
Parse a query according to the context.
|
static org.elasticsearch.search.suggest.context.CategoryContextMapping.FieldQuery |
query(String name,
CharSequence... fieldvalues) |
static org.elasticsearch.search.suggest.context.CategoryContextMapping.FieldQuery |
query(String name,
Iterable<? extends CharSequence> fieldvalues) |
protected XContentBuilder |
toInnerXContent(XContentBuilder builder,
ToXContent.Params params)
Since every context mapping is assumed to have a name given by the field name of an context object, this
method is used to build the value used to serialize the mapping
|
mappingsAreEqual, name, toString, toXContent, type
protected static final String TYPE
public CategoryContextMapping(String name)
CategoryContextMapping
with the default field
[_type]
public CategoryContextMapping(String name, String fieldName)
CategoryContextMapping
with the default field
[_type]
public CategoryContextMapping(String name, Iterable<? extends CharSequence> defaultValues)
CategoryContextMapping
with the default field
[_type]
public CategoryContextMapping(String name, String fieldName, Iterable<? extends CharSequence> defaultValues)
CategoryContextMapping
with the default field
[_type]
public String getFieldName()
CategoryContextMapping
public Iterable<? extends CharSequence> getDefaultValues()
public org.elasticsearch.search.suggest.context.CategoryContextMapping.FieldConfig defaultConfig()
defaultConfig
in class ContextMapping
protected static CategoryContextMapping load(String name, Map<String,Object> config) throws ElasticsearchParseException
CategoryContextMapping
field
- name of the field to use. If null
default field
will be usedCategoryContextMapping
ElasticsearchParseException
protected XContentBuilder toInnerXContent(XContentBuilder builder, ToXContent.Params params) throws IOException
ContextMapping
toInnerXContent
in class ContextMapping
builder
- builder to append the mapping toparams
- parameters passed to the builderIOException
public ContextMapping.ContextConfig parseContext(ParseContext parseContext, XContentParser parser) throws IOException, ElasticsearchParseException
ContextMapping
ContextMapping
combined with the information provided by a document
form a ContextMapping.ContextConfig
which is used to build the underlying FST.parseContext
in class ContextMapping
parseContext
- context of parsing phaseparser
- XContentParser
used to read and setup the configurationContextMapping.ContextConfig
related to this mappingIOException
ElasticsearchParseException
public org.elasticsearch.search.suggest.context.CategoryContextMapping.FieldQuery parseQuery(String name, XContentParser parser) throws IOException, ElasticsearchParseException
ContextMapping
parseQuery
in class ContextMapping
name
- name of the contextparser
- XContentParser
providing the data of the queryContextMapping.ContextQuery
according to this mappingIOException
ElasticsearchParseException
public static org.elasticsearch.search.suggest.context.CategoryContextMapping.FieldQuery query(String name, CharSequence... fieldvalues)
public static org.elasticsearch.search.suggest.context.CategoryContextMapping.FieldQuery query(String name, Iterable<? extends CharSequence> fieldvalues)
Copyright © 2009–2016. All rights reserved.