| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 | [[ignore-above]]=== `ignore_above`Strings longer than the `ignore_above` setting will not be indexed or stored.[source,js]--------------------------------------------------PUT my_index{  "mappings": {    "_doc": {      "properties": {        "message": {          "type": "keyword",          "ignore_above": 20 <1>        }      }    }  }}PUT my_index/_doc/1 <2>{  "message": "Syntax error"}PUT my_index/_doc/2 <3>{  "message": "Syntax error with some long stacktrace"}GET _search <4>{  "aggs": {    "messages": {      "terms": {        "field": "message"      }    }  }}--------------------------------------------------// CONSOLE<1> This field will ignore any string longer than 20 characters.<2> This document is indexed successfully.<3> This document will be indexed, but without indexing the `message` field.<4> Search returns both documents, but only the first is present in the terms aggregation.TIP: The `ignore_above` setting is allowed to have different settings forfields of the same name in the same index.  Its value can be updated onexisting fields using the <<indices-put-mapping,PUT mapping API>>.This option is also useful for protecting against Lucene's term byte-lengthlimit of `32766`.NOTE: The value for `ignore_above` is the _character count_, but Lucene countsbytes. If you use UTF-8 text with many non-ASCII characters, you may want toset the limit to `32766 / 4 = 8191` since UTF-8 characters may occupy at most4 bytes.
 |