# Attachment-mapper - changing analyzer

**URL:** <https://discuss.elastic.co/t/attachment-mapper-changing-analyzer/39379>\
**Category:** Elasticsearch\
**Created:** [January 16, 2016, 12:47pm UTC](https://discuss.elastic.co/t/attachment-mapper-changing-analyzer/39379 "2016-01-16T12:47:53Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![leewadhams](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leewadhams/32/7197_2.png) [@leewadhams](https://discuss.elastic.co/u/leewadhams)\
**Post date:** [January 16, 2016, 12:47pm UTC](https://discuss.elastic.co/t/attachment-mapper-changing-analyzer/39379/1 "2016-01-16T12:47:53Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [January 16, 2016, 2:15pm UTC](https://discuss.elastic.co/t/attachment-mapper-changing-analyzer/39379/2 "2016-01-16T14:15:42Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![leewadhams](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leewadhams/32/7197_2.png) [@leewadhams](https://discuss.elastic.co/u/leewadhams)\
**Post date:** [January 16, 2016, 8:02pm UTC](https://discuss.elastic.co/t/attachment-mapper-changing-analyzer/39379/3 "2016-01-16T20:02:45Z")

</div>

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; }
}
```

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [January 16, 2016, 8:25pm UTC](https://discuss.elastic.co/t/attachment-mapper-changing-analyzer/39379/4 "2016-01-16T20:25:36Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![leewadhams](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leewadhams/32/7197_2.png) [@leewadhams](https://discuss.elastic.co/u/leewadhams)\
**Post date:** [January 28, 2016, 12:08pm UTC](https://discuss.elastic.co/t/attachment-mapper-changing-analyzer/39379/5 "2016-01-28T12:08:41Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![totessusan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/totessusan/32/13028_2.png) [@totessusan](https://discuss.elastic.co/u/totessusan)\
**Post date:** [November 2, 2016, 7:06pm UTC](https://discuss.elastic.co/t/attachment-mapper-changing-analyzer/39379/6 "2016-11-02T19:06:10Z")

</div>

@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. 😢 I'm also using NEST.

---

<div class="post-metadata">

**Author:** ![tibmoh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tibmoh/32/19097_2.png) [@tibmoh](https://discuss.elastic.co/u/tibmoh)\
**Post date:** [June 13, 2017, 8:03pm UTC](https://discuss.elastic.co/t/attachment-mapper-changing-analyzer/39379/7 "2017-06-13T20:03:07Z")

</div>

Is there any solution to resolve this issue?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [November 4, 2022, 4:12am UTC](https://discuss.elastic.co/t/attachment-mapper-changing-analyzer/39379/8 "2022-11-04T04:12:56Z")

</div>


