Class PutMappingDescriptor<TDocument>
Descriptor for PutMapping
https://opensearch.org/docs/latest/api-reference/index-apis/put-mapping/
Inheritance
PutMappingDescriptor<TDocument>
Assembly: OpenSearch.Client.dll
Syntax
[DataContract]
public class PutMappingDescriptor<TDocument> : RequestDescriptorBase<PutMappingDescriptor<TDocument>, PutMappingRequestParameters, IPutMappingRequest<TDocument>>, IDescriptor, IPutMappingRequest<TDocument>, IPutMappingRequest, ITypeMapping, IRequest<PutMappingRequestParameters>, IRequest where TDocument : class
Type Parameters
Name |
Description |
TDocument |
|
Constructors
|
Edit this page
View Source
PutMappingDescriptor()
Declaration
public PutMappingDescriptor()
|
Edit this page
View Source
PutMappingDescriptor(Indices)
Declaration
public PutMappingDescriptor(Indices index)
Parameters
Type |
Name |
Description |
Indices |
index |
this parameter is required
|
Methods
|
Edit this page
View Source
AllIndices()
A shortcut into calling Index(Indices.All)
Declaration
public PutMappingDescriptor<TDocument> AllIndices()
Returns
|
Edit this page
View Source
AllowNoIndices(bool?)
If false
, the request returns an error if any wildcard expression, index alias, or _all
value targets only missing or closed indexes. This behavior applies even if the request targets other open indexes.
Declaration
public PutMappingDescriptor<TDocument> AllowNoIndices(bool? allownoindices = true)
Parameters
Type |
Name |
Description |
bool? |
allownoindices |
|
Returns
|
Edit this page
View Source
Assign<TValue>(TValue, Action<ITypeMapping, TValue>)
Declaration
protected PutMappingDescriptor<TDocument> Assign<TValue>(TValue value, Action<ITypeMapping, TValue> assigner)
Parameters
Returns
Type Parameters
|
Edit this page
View Source
AutoMap(IPropertyVisitor, int)
Convenience method to map as much as it can based on OpenSearchType attributes set on the type.
This method also automatically sets up mappings for primitive values types (e.g. int, long, double, DateTime...)
Class types default to object and Enums to int
Later calls can override whatever is set by this call.
Declaration
public PutMappingDescriptor<TDocument> 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 OpenSearchType attributes set on the type.
This method also automatically sets up mappings for primitive values types (e.g. int, long, double, DateTime...)
Class types default to object and Enums to int
Later calls can override whatever is set by this call.
Declaration
public PutMappingDescriptor<TDocument> AutoMap(int maxRecursion)
Parameters
Type |
Name |
Description |
int |
maxRecursion |
|
Returns
|
Edit this page
View Source
ClusterManagerTimeout(Time)
Operation timeout for connection to cluster-manager node.
Declaration
public PutMappingDescriptor<TDocument> ClusterManagerTimeout(Time clustermanagertimeout)
Parameters
Type |
Name |
Description |
Time |
clustermanagertimeout |
|
Returns
|
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 PutMappingDescriptor<TDocument> 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 PutMappingDescriptor<TDocument> 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 PutMappingDescriptor<TDocument> 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 PutMappingDescriptor<TDocument> Dynamic(bool? dynamic = true)
Parameters
Type |
Name |
Description |
bool? |
dynamic |
|
Returns
|
Edit this page
View Source
Declaration
public PutMappingDescriptor<TDocument> DynamicDateFormats(IEnumerable<string> dateFormats)
Parameters
Returns
|
Edit this page
View Source
DynamicTemplates(Func<DynamicTemplateContainerDescriptor<TDocument>, 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 PutMappingDescriptor<TDocument> DynamicTemplates(Func<DynamicTemplateContainerDescriptor<TDocument>, IPromise<IDynamicTemplateContainer>> dynamicTemplatesSelector)
Parameters
Returns
|
Edit this page
View Source
ExpandWildcards(ExpandWildcards?)
Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as open,hidden
. Valid values are: all
, open
, closed
, hidden
, none
.
Declaration
public PutMappingDescriptor<TDocument> ExpandWildcards(ExpandWildcards? expandwildcards)
Parameters
Returns
|
Edit this page
View Source
FieldNamesField(Func<FieldNamesFieldDescriptor<TDocument>, 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 PutMappingDescriptor<TDocument> FieldNamesField(Func<FieldNamesFieldDescriptor<TDocument>, IFieldNamesField> fieldNamesFieldSelector)
Parameters
Returns
|
Edit this page
View Source
IgnoreUnavailable(bool?)
If false
, the request returns an error if it targets a missing or closed index.
Declaration
public PutMappingDescriptor<TDocument> IgnoreUnavailable(bool? ignoreunavailable = true)
Parameters
Type |
Name |
Description |
bool? |
ignoreunavailable |
|
Returns
|
Edit this page
View Source
IncludeTypeName(bool?)
Whether a type should be expected in the body of the mappings.
Declaration
public PutMappingDescriptor<TDocument> IncludeTypeName(bool? includetypename = true)
Parameters
Type |
Name |
Description |
bool? |
includetypename |
|
Returns
|
Edit this page
View Source
Index(Indices)
A comma-separated list of index names the mapping should be added to (supports wildcards); use _all
or omit to add the mapping on all indexes.
Declaration
public PutMappingDescriptor<TDocument> Index(Indices index)
Parameters
Type |
Name |
Description |
Indices |
index |
|
Returns
|
Edit this page
View Source
Index<TOther>()
a shortcut into calling Index(typeof(TOther))
Declaration
public PutMappingDescriptor<TDocument> Index<TOther>() where TOther : class
Returns
Type Parameters
|
Edit this page
View Source
MasterTimeout(Time)
Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request fails and returns an error.
Declaration
[Obsolete("Deprecated as of: 2.0.0, reason: To promote inclusive language, use `cluster_manager_timeout` instead.")]
public PutMappingDescriptor<TDocument> MasterTimeout(Time mastertimeout)
Parameters
Type |
Name |
Description |
Time |
mastertimeout |
|
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 PutMappingDescriptor<TDocument> 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 PutMappingDescriptor<TDocument> 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 PutMappingDescriptor<TDocument> NumericDetection(bool? detect = true)
Parameters
Type |
Name |
Description |
bool? |
detect |
|
Returns
|
Edit this page
View Source
Properties(Func<PropertiesDescriptor<TDocument>, IPromise<IProperties>>)
Specifies the mapping properties
Declaration
public PutMappingDescriptor<TDocument> Properties(Func<PropertiesDescriptor<TDocument>, IPromise<IProperties>> propertiesSelector)
Parameters
Returns
|
Edit this page
View Source
RoutingField(Func<RoutingFieldDescriptor<TDocument>, IRoutingField>)
Specifies configuration for the _routing parameter
Declaration
public PutMappingDescriptor<TDocument> RoutingField(Func<RoutingFieldDescriptor<TDocument>, IRoutingField> routingFieldSelector)
Parameters
Returns
|
Edit this page
View Source
RuntimeFields(Func<RuntimeFieldsDescriptor<TDocument>, IPromise<IRuntimeFields>>)
Specifies runtime fields for the mapping.
Declaration
public PutMappingDescriptor<TDocument> RuntimeFields(Func<RuntimeFieldsDescriptor<TDocument>, IPromise<IRuntimeFields>> runtimeFieldsSelector)
Parameters
Returns
|
Edit this page
View Source
RuntimeFields<TSource>(Func<RuntimeFieldsDescriptor<TSource>, IPromise<IRuntimeFields>>)
Specifies runtime fields for the mapping.
Declaration
public PutMappingDescriptor<TDocument> RuntimeFields<TSource>(Func<RuntimeFieldsDescriptor<TSource>, IPromise<IRuntimeFields>> runtimeFieldsSelector) where TSource : class
Parameters
Returns
Type Parameters
|
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 PutMappingDescriptor<TDocument> SizeField(Func<SizeFieldDescriptor, ISizeField> sizeFieldSelector)
Parameters
Returns
|
Edit this page
View Source
SourceField(Func<SourceFieldDescriptor, ISourceField>)
Specifies configuration for the _source field
Declaration
public PutMappingDescriptor<TDocument> SourceField(Func<SourceFieldDescriptor, ISourceField> sourceFieldSelector)
Parameters
Returns
|
Edit this page
View Source
Timeout(Time)
Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.
Declaration
public PutMappingDescriptor<TDocument> Timeout(Time timeout)
Parameters
Type |
Name |
Description |
Time |
timeout |
|
Returns
|
Edit this page
View Source
WriteIndexOnly(bool?)
If true
, the mappings are applied only to the current write index for the target.
Declaration
public PutMappingDescriptor<TDocument> WriteIndexOnly(bool? writeindexonly = true)
Parameters
Type |
Name |
Description |
bool? |
writeindexonly |
|
Returns
Implements
Extension Methods