This documentation contains work-in-progress information for future Elastic Stack and Cloud releases. Use the version selector to view supported release docs. It also contains some Elastic Cloud serverless information. Check out our serverless docs for more details.
Custom mapping examples
editCustom mapping examples
editThis page demonstrates how to configure custom mappings on an index.
Configure mappings during index creation
editawait client.Indices.CreateAsync<Person>(index => index .Index("index") .Mappings(mappings => mappings .Properties(properties => properties .IntegerNumber(x => x.Age!) .Keyword(x => x.FirstName!, keyword => keyword.Index(false)) ) ) );
Configure mappings after index creation
editawait client.Indices.PutMappingAsync<Person>(mappings => mappings .Indices("index") .Properties(properties => properties .IntegerNumber(x => x.Age!) .Keyword(x => x.FirstName!, keyword => keyword.Index(false)) ) );