Loading

Custom mapping examples

This page demonstrates how to configure custom mappings on an index.

await 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))
        )
    )
);
await client.Indices.PutMappingAsync<Person>(mappings => mappings
    .Indices("index")
    .Properties(properties => properties
        .IntegerNumber(x => x.Age!)
        .Keyword(x => x.FirstName!, keyword => keyword.Index(false))
    )
);