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

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.

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