Attachment-mapper - changing analyzer

How do I change the analyzer of the content field for an attachment property?

I'm trying to do it using the .Net Nest client with: .AddMapping(m => m.MapFromAttributes())

and decorating my Attachment class with: [ElasticProperty(Analyzer = "english")]

But this change is not being made.

I don't seem to be able to update the analyzer on the field after the index and mapping has been created either by making a cUrl request:

PUT myindex/_mapping/mydocument
{
  "properties": {
    "file":
    {
      "type": "attachment", 
      "fields": {
        "content":
        {
          "type": "string", 
          "analyzer": "english"
        }
      }
    }
  }
}

I'm pretty new to elasticsearch so it's very likely that there's an obvious mistake that I'm making.

Any help would be appreciated.

You can't update a field mapping once it has already been created.

That's fair enough. From the Nest point of view it was on creation of the index that I was creating the mapping from the attributes of my c# classes. It doesn't seem to take any notice.

My classes:

private class MyDocument
{
    public string Name { get; set; }

    public int Age { get; set; }
    [ElasticProperty(Type = FieldType.Attachment, TermVector = TermVectorOption.WithPositionsOffsets)]
    public Attachment File { get; set; }
}

private class Attachment
{
    [ElasticProperty(Analyzer="english", Name ="_content")]
    public string Contents { get; set; }
}

I can't help on NEST. May be @Martijn_Laarman could help?

I tried @Martign_Laarman but have had no reply sadly. Is there anyone else you might be able to help?

@leewadhams Did you happen to figure out what the problem was? I'm running into the same problem where I can't specify an analyzer to use on the "_content" field of the mapper attachment on index creation. :cry: I'm also using NEST.

Is there any solution to resolve this issue?