1

For the attribute part, is there any form to tell NEST to use copy to by attributes? I want to create my mapping dynamically, so that I don't code the field property when creating my CreateIndexDescriptor object.

Example of attribute mapping:

[String(Analyzer="analyzer_shingles")]
public string company_no { get; set; }

Now for the reflection part... Is there any way to use the Map<T> method dynamically?

Example of non-dynamic Mapping:

var mapperTemplate = new CreateIndexDescriptor(string.Format("customers"))
  .Settings(s => s
    .Analysis(a => a
      .Analyzers(an => an
        .UserDefined("analyzer_shingles", shingles)
        .UserDefined("didYouMean", didYouMean)
      )
    )
  );
var customer = mapperTemplate.Mappings(ms => ms
  .Map<customer>(m => m
    .AllField(a => a.Analyzer("analyzer_shingles"))
    .AutoMap()
  )
);

I've tried obtaining the methods and passing new lambdas, but I'm stuck at passing parameters to the Map method. I can't find a form to use MakeGenericType on:

new Func<TypeMappingDescriptor<T>, ITypeMapping>

Also, Map with a TypeName parameter doesn't seem to do the work.

Help is much appreciated.

Josué Zatarain
  • 791
  • 6
  • 21
  • Can you explain a bit more about why you want to map _dynamically_? Perhaps there is another way to do what you are trying to achieve – Russ Cam May 31 '16 at 07:41
  • I have a POCO classes generator that takes a list of sql server tables. Maybe sometimes I want to index different tables, and I don't want to edit my code just for that. I **solved** the whole Issue of NEST by creating a json dynamically for every table. – Josué Zatarain May 31 '16 at 14:54

0 Answers0