C# NEST - Multi fields mapping of a single field with attributes


(Dlalex83) #1

Hi there,

I'm using NEST's attribute based mapping to map my document and I need to map a field to multiple fields so to store different versions based on different analyzers (e.g. name, name.not_analyzed etc..).
I don't seem to find a way to to do that with attribute mapping. Is it not implemented?

I've found how to do that with the AutoMap method (see below)

index.Mappings(maps => maps.Map(m =>
{
m.AutoMap()
.Properties(p => p
.String(s => s
.Name(n => n.Description).Analyzer("my_analyzer")
.Fields(f => f
.String(fs => fs.Name("not_analyzed").NotAnalyzed())
)});

With this method though, I'm struggling to get the syntax right to define "fields" on a nested object's string property.

Any suggestions?

Thanks


(system) #2