# How to build attribute mapping for text with keyword in Nest C#

**URL:** <https://discuss.elastic.co/t/how-to-build-attribute-mapping-for-text-with-keyword-in-nest-c/169059>\
**Category:** Elasticsearch\
**Created:** [February 19, 2019, 4:02pm UTC](https://discuss.elastic.co/t/how-to-build-attribute-mapping-for-text-with-keyword-in-nest-c/169059 "2019-02-19T16:02:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nico92](https://avatars.discourse-cdn.com/v4/letter/n/a87d85/32.png) [@Nico92](https://discuss.elastic.co/u/Nico92)\
**Post date:** [February 19, 2019, 4:02pm UTC](https://discuss.elastic.co/t/how-to-build-attribute-mapping-for-text-with-keyword-in-nest-c/169059/1 "2019-02-19T16:02:33Z")

</div>

Hey guys,

I'm building my application with C#.

I want to build an field with text and keyword with ignore\_above = int.MaxValue.  
All of that I want to do with attribute mapping of my model class.

```
[ElasticsearchType(Name = "doc")]
   public class MessageDto
   {
      [Text(Name = "message")]
      [Keyword(IgnoreAbove = int.MaxValue)]
      public string Message { get; set; }
   }
```

I have tried multiple cases:

Number 1:

```
[Text(Name = "message")]
   [Keyword(IgnoreAbove = int.MaxValue)]
   public string Message { get; set; }
```

Number 2:

```
[Text(Name = "message"), Keyword(IgnoreAbove = int.MaxValue)]
   public string Message { get; set; }
```

Both got me the same exception: \>\>Multiple custom attributes of the same type found.\<\<

The normal case without any annotation:

```
public string Message { get; set; }
```

Gets:

```
"message" : {
  "type" : "text",
  "fields" : {
    "keyword" : {
      "type" : "keyword",
      "ignore_above" : 256
    }
  }
}
```

But I want:

```
"message" : {
  "type" : "text",
  "fields" : {
    "keyword" : {
      "type" : "keyword",
      "ignore_above" : 2147483647
    }
  }
}
```

Everyone an idea, how it works?  
Thank you for helping me.

---

<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:** [March 19, 2019, 4:02pm UTC](https://discuss.elastic.co/t/how-to-build-attribute-mapping-for-text-with-keyword-in-nest-c/169059/2 "2019-03-19T16:02:42Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
