elasticsearch/docs/reference/elasticsearch/mapping-reference/ignore-above.md
Colleen McGinnis b7e3a1e14b
[docs] Migrate docs from AsciiDoc to Markdown (#123507)
* delete asciidoc files

* add migrated files

* fix errors

* Disable docs tests

* Clarify release notes page titles

* Revert "Clarify release notes page titles"

This reverts commit 8be688648d.

* Comment out edternal URI images

* Clean up query languages landing pages, link to conceptual docs

* Add .md to url

* Fixes inference processor nesting.

---------

Co-authored-by: Liam Thompson <32779855+leemthompo@users.noreply.github.com>
Co-authored-by: Liam Thompson <leemthompo@gmail.com>
Co-authored-by: Martijn Laarman <Mpdreamz@gmail.com>
Co-authored-by: István Zoltán Szabó <szabosteve@gmail.com>
2025-02-27 17:56:14 +01:00

67 lines
1.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
mapped_pages:
- https://www.elastic.co/guide/en/elasticsearch/reference/current/ignore-above.html
---
# ignore_above [ignore-above]
Strings longer than the `ignore_above` setting will not be indexed or stored. For arrays of strings, `ignore_above` will be applied for each array element separately and string elements longer than `ignore_above` will not be indexed or stored.
::::{note}
All strings/array elements will still be present in the `_source` field, if the latter is enabled which is the default in Elasticsearch.
::::
```console
PUT my-index-000001
{
"mappings": {
"properties": {
"message": {
"type": "keyword",
"ignore_above": 20 <1>
}
}
}
}
PUT my-index-000001/_doc/1 <2>
{
"message": "Syntax error"
}
PUT my-index-000001/_doc/2 <3>
{
"message": "Syntax error with some long stacktrace"
}
GET my-index-000001/_search <4>
{
"aggs": {
"messages": {
"terms": {
"field": "message"
}
}
}
}
```
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 can be updated on existing fields using the [update mapping API](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-put-mapping).
::::
This option is also useful for protecting against Lucenes term byte-length limit of `32766`.
::::{note}
The value for `ignore_above` is the *character count*, but Lucene counts bytes. If you use UTF-8 text with many non-ASCII characters, you may want to set the limit to `32766 / 4 = 8191` since UTF-8 characters may occupy at most 4 bytes.
::::