Class TypeMappingDescriptor<T>
Inheritance
TypeMappingDescriptor<T>
Assembly: OpenSearch.Client.dll
Syntax
public class TypeMappingDescriptor<T> : DescriptorBase<TypeMappingDescriptor<T>, ITypeMapping>, IDescriptor, ITypeMapping where T : class
Type Parameters
Methods
|
Edit this page
View Source
AutoMap(IPropertyVisitor, int)
Convenience method to map as much as it can based on OpenSearchTypeAttribute attributes set on the
type, as well as inferring mappings from the CLR property types.
This method also automatically sets up mappings for known values types (int, long, double, datetime, etc)
Class types default to object and Enums to int
Later calls can override whatever is set is by this call.
Declaration
public TypeMappingDescriptor<T> AutoMap(IPropertyVisitor visitor = null, int maxRecursion = 0)
Parameters
Returns
|
Edit this page
View Source
AutoMap(int)
Convenience method to map as much as it can based on OpenSearchTypeAttribute attributes set on the
type, as well as inferring mappings from the CLR property types.
This overload determines how deep automapping should recurse on a complex CLR type.
Declaration
public TypeMappingDescriptor<T> AutoMap(int maxRecursion)
Parameters
Type |
Name |
Description |
int |
maxRecursion |
|
Returns
|
Edit this page
View Source
AutoMap(Type, IPropertyVisitor, int)
Convenience method to map as much as it can based on OpenSearchTypeAttribute attributes set on the
type, as well as inferring mappings from the CLR property types.
This particular overload is useful for automapping any children
This method also automatically sets up mappings for known values types (int, long, double, datetime, etc)
Class types default to object and Enums to int
Later calls can override whatever is set is by this call.
Declaration
public TypeMappingDescriptor<T> AutoMap(Type documentType, IPropertyVisitor visitor = null, int maxRecursion = 0)
Parameters
Returns
|
Edit this page
View Source
AutoMap<TDocument>(IPropertyVisitor, int)
Convenience method to map as much as it can based on OpenSearchTypeAttribute attributes set on the
type, as well as inferring mappings from the CLR property types.
This particular overload is useful for automapping any children
This method also automatically sets up mappings for known values types (int, long, double, datetime, etc)
Class types default to object and Enums to int
Later calls can override whatever is set is by this call.
Declaration
public TypeMappingDescriptor<T> AutoMap<TDocument>(IPropertyVisitor visitor = null, int maxRecursion = 0) where TDocument : class
Parameters
Returns
Type Parameters
Name |
Description |
TDocument |
|
|
Edit this page
View Source
DateDetection(bool?)
If enabled (default), then new string fields are checked to see whether their contents match
any of the date patterns specified in DynamicDateFormats.
If a match is found, a new date field is added with the corresponding format.
Declaration
public TypeMappingDescriptor<T> DateDetection(bool? detect = true)
Parameters
Type |
Name |
Description |
bool? |
detect |
|
Returns
|
Edit this page
View Source
DisableSizeField(bool?)
If enabled, indexes the size in bytes of the original _source field.
Requires mapper-size plugin be installed
Declaration
public TypeMappingDescriptor<T> DisableSizeField(bool? disabled = true)
Parameters
Type |
Name |
Description |
bool? |
disabled |
|
Returns
|
Edit this page
View Source
Dynamic(Union<bool, DynamicMapping>)
Whether new unseen fields will be added to the mapping. Default is true
.
A value of false
will ignore unknown fields and a value of Strict
will result in an error if an unknown field is encountered in a document.
Declaration
public TypeMappingDescriptor<T> Dynamic(Union<bool, DynamicMapping> dynamic)
Parameters
Returns
|
Edit this page
View Source
Dynamic(bool)
Whether new unseen fields will be added to the mapping. Default is true
.
A value of false
will ignore unknown fields and a value of Strict
will result in an error if an unknown field is encountered in a document.
Declaration
public TypeMappingDescriptor<T> Dynamic(bool dynamic = true)
Parameters
Type |
Name |
Description |
bool |
dynamic |
|
Returns
|
Edit this page
View Source
Declaration
public TypeMappingDescriptor<T> DynamicDateFormats(IEnumerable<string> dateFormats)
Parameters
Returns
|
Edit this page
View Source
DynamicTemplates(Func<DynamicTemplateContainerDescriptor<T>, IPromise<IDynamicTemplateContainer>>)
Dynamic templates allow you to define custom mappings that can be applied to dynamically added fields based on
- the datatype detected by OpenSearch, with MatchMappingType.
- the name of the field, with Match and Unmatch or
MatchPattern.
- the full dotted path to the field, with PathMatch and
PathUnmatch.
The original field name {name}
and the detected datatype {dynamic_type}
template variables can be
used in the mapping specification as placeholders.
Declaration
public TypeMappingDescriptor<T> DynamicTemplates(Func<DynamicTemplateContainerDescriptor<T>, IPromise<IDynamicTemplateContainer>> dynamicTemplatesSelector)
Parameters
Returns
|
Edit this page
View Source
FieldNamesField(Func<FieldNamesFieldDescriptor<T>, IFieldNamesField>)
Used to index the names of every field in a document that contains any value other than null.
This field was used by the exists query to find documents that either have or don’t have any non-null value for a particular field.
Now, it only indexes the names of fields that have doc_values and norms disabled.
Can be disabled. Disabling _field_names is often not necessary because it no longer carries the index overhead it once did.
If you have a lot of fields which have doc_values and norms disabled and you do not need to execute exists queries
using those fields you might want to disable
Declaration
public TypeMappingDescriptor<T> FieldNamesField(Func<FieldNamesFieldDescriptor<T>, IFieldNamesField> fieldNamesFieldSelector)
Parameters
Returns
|
Edit this page
View Source
Custom meta data to associate with a mapping. Not used by OpenSearch,
but can be used to store application-specific metadata.
Declaration
public TypeMappingDescriptor<T> Meta(Dictionary<string, object> metaDictionary)
Parameters
Returns
|
Edit this page
View Source
Custom meta data to associate with a mapping. Not used by OpenSearch,
but can be used to store application-specific metadata.
Declaration
public TypeMappingDescriptor<T> Meta(Func<FluentDictionary<string, object>, FluentDictionary<string, object>> metaSelector)
Parameters
Returns
|
Edit this page
View Source
NumericDetection(bool?)
If enabled (not enabled by default), then new string fields are checked to see whether
they wholly contain a numeric value and if so, to map as a numeric field.
Declaration
public TypeMappingDescriptor<T> NumericDetection(bool? detect = true)
Parameters
Type |
Name |
Description |
bool? |
detect |
|
Returns
|
Edit this page
View Source
Properties(Func<PropertiesDescriptor<T>, IPromise<IProperties>>)
Specifies the mapping properties
Declaration
public TypeMappingDescriptor<T> Properties(Func<PropertiesDescriptor<T>, IPromise<IProperties>> propertiesSelector)
Parameters
Returns
|
Edit this page
View Source
Properties<TDocument>(Func<PropertiesDescriptor<TDocument>, IPromise<IProperties>>)
Specifies the mapping properties
Declaration
public TypeMappingDescriptor<T> Properties<TDocument>(Func<PropertiesDescriptor<TDocument>, IPromise<IProperties>> propertiesSelector) where TDocument : class
Parameters
Returns
Type Parameters
Name |
Description |
TDocument |
|
|
Edit this page
View Source
RoutingField(Func<RoutingFieldDescriptor<T>, IRoutingField>)
Specifies configuration for the _routing parameter
Declaration
public TypeMappingDescriptor<T> RoutingField(Func<RoutingFieldDescriptor<T>, IRoutingField> routingFieldSelector)
Parameters
Returns
|
Edit this page
View Source
RuntimeFields(Func<RuntimeFieldsDescriptor<T>, IPromise<IRuntimeFields>>)
Declaration
public TypeMappingDescriptor<T> RuntimeFields(Func<RuntimeFieldsDescriptor<T>, IPromise<IRuntimeFields>> runtimeFieldsSelector)
Parameters
Returns
|
Edit this page
View Source
RuntimeFields<TDocument>(Func<RuntimeFieldsDescriptor<TDocument>, IPromise<IRuntimeFields>>)
Specifies runtime fields for the mapping.
Declaration
public TypeMappingDescriptor<T> RuntimeFields<TDocument>(Func<RuntimeFieldsDescriptor<TDocument>, IPromise<IRuntimeFields>> runtimeFieldsSelector) where TDocument : class
Parameters
Returns
Type Parameters
Name |
Description |
TDocument |
|
|
Edit this page
View Source
SizeField(Func<SizeFieldDescriptor, ISizeField>)
If enabled, indexes the size in bytes of the original _source field.
Requires mapper-size plugin be installed
Declaration
public TypeMappingDescriptor<T> SizeField(Func<SizeFieldDescriptor, ISizeField> sizeFieldSelector)
Parameters
Returns
|
Edit this page
View Source
SourceField(Func<SourceFieldDescriptor, ISourceField>)
Specifies configuration for the _source field
Declaration
public TypeMappingDescriptor<T> SourceField(Func<SourceFieldDescriptor, ISourceField> sourceFieldSelector)
Parameters
Returns
Implements
Extension Methods