> For the complete documentation index, see [llms.txt](https://xiaoxiami.gitbook.io/elasticsearch/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://xiaoxiami.gitbook.io/elasticsearch/ji-chu/mapping/323mapping-parametersff08-ying-she-can-shu-ff09/ignoreabove-ff08-hu-lve-chao-yue-xian-zhi-de-zi-duan-ff09.md).

# ignore\_above（忽略超越限制的字段）

字符串长度超过**ignore\_above**设置的不会被索引和存储.

```
curl -XPUT 'localhost:9200/my_index?pretty' -H 'Content-Type: application/json' -d'
{
  "mappings": {
    "my_type": {
      "properties": {
        "message": {
          "type": "keyword",
          "ignore_above": 20  # 1
        }
      }
    }
  }
}
'
curl -XPUT 'localhost:9200/my_index/my_type/1?pretty' -H 'Content-Type:  application/json' -d' # 2
{
  "message": "Syntax error"
}
'
curl -XPUT 'localhost:9200/my_index/my_type/2?pretty' -H 'Content-Type:  application/json' -d' # 3
{
  "message": "Syntax error with some long stacktrace"
}
'
curl -XGET 'localhost:9200/_search?pretty' -H 'Content-Type: application/json' -d' # 4
{
  "aggs": {
    "messages": {
      "terms": {
        "field": "message"
      }
    }
  }
}
```

| 1 | 字段会忽略超过20个字符的字符串.                       |
| - | --------------------------------------- |
| 2 | 这个**document**成功被索引.                    |
| 3 | 这个**document**会被索引,但是不会索引**message**字段. |
| 4 | 搜索返回两个文档,但只有第一个存在于**terms**（词条）聚合中.     |

> tip
>
> **ignore\_above**设置允许在相同索引的相同名称的字段有不同的配置,可以使用[PUT mapping API](https://www.elastic.co/guide/en/elasticsearch/reference/5.3/indices-put-mapping.html)在现有字段上更新其值。

此选项对于防止Lucene term（词条）长度超过32766是有用的.\
**ignore\_above** 的值是字符数，但 **Lucene** 计数的是字节。所以如果你使用具有许多非ASCII字符的UTF-8文本，则可能需要将限制设置为 **32766/3 = 10922**，因为UTF-8字符可能占用至多3个字节。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://xiaoxiami.gitbook.io/elasticsearch/ji-chu/mapping/323mapping-parametersff08-ying-she-can-shu-ff09/ignoreabove-ff08-hu-lve-chao-yue-xian-zhi-de-zi-duan-ff09.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
