# Mappings (Ignore\_above)

**URL:** <https://discuss.elastic.co/t/mappings-ignore-above/363076>\
**Category:** Elasticsearch\
**Created:** [July 13, 2024, 3:22pm UTC](https://discuss.elastic.co/t/mappings-ignore-above/363076 "2024-07-13T15:22:48Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![dsagent](https://avatars.discourse-cdn.com/v4/letter/d/d2c977/32.png) [@dsagent](https://discuss.elastic.co/u/dsagent)\
**Post date:** [July 13, 2024, 3:22pm UTC](https://discuss.elastic.co/t/mappings-ignore-above/363076/1 "2024-07-13T15:22:48Z")

</div>

I have a field with data of numbers, letters, symbols, and the length of this dystrophy is more than 255, and I want to use term to return the data accurately, but it does not return anything, and when I use match, it returns field data similar to the value of the field I want, knowing that I have similar fields  
How can I search this field with more than 255

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [July 13, 2024, 6:09pm UTC](https://discuss.elastic.co/t/mappings-ignore-above/363076/2 "2024-07-13T18:09:09Z")

</div>

Hi @dsagent

if you would like help, You will need to provide

- Sample documents
- Sample Mapping
- Sample Query
- Sample results

---

<div class="post-metadata">

**Author:** ![dsagent](https://avatars.discourse-cdn.com/v4/letter/d/d2c977/32.png) [@dsagent](https://discuss.elastic.co/u/dsagent)\
**Post date:** [July 13, 2024, 6:19pm UTC](https://discuss.elastic.co/t/mappings-ignore-above/363076/3 "2024-07-13T18:19:24Z")

</div>

![2024-07-13 21_11_18-172.20.10.41 - Remote Desktop Connection](https://us1.discourse-cdn.com/elastic/original/3X/a/2/a2862d1447064e47c39875735968c2c3765eac2d.png)

\*this index

---

<div class="post-metadata">

**Author:** ![dsagent](https://avatars.discourse-cdn.com/v4/letter/d/d2c977/32.png) [@dsagent](https://discuss.elastic.co/u/dsagent)\
**Post date:** [July 13, 2024, 6:20pm UTC](https://discuss.elastic.co/t/mappings-ignore-above/363076/4 "2024-07-13T18:20:02Z")

</div>

![2024-07-13 21_14_17-172.20.10.41 - Remote Desktop Connection](https://us1.discourse-cdn.com/elastic/original/3X/0/7/07a16e8d1e8964dcc8867cf11dcca6d10a6a2db2.png)

Sample Mapping

---

<div class="post-metadata">

**Author:** ![dsagent](https://avatars.discourse-cdn.com/v4/letter/d/d2c977/32.png) [@dsagent](https://discuss.elastic.co/u/dsagent)\
**Post date:** [July 13, 2024, 6:20pm UTC](https://discuss.elastic.co/t/mappings-ignore-above/363076/5 "2024-07-13T18:20:38Z")

</div>

![2024-07-13 21_13_01-172.20.10.41 - Remote Desktop Connection](https://us1.discourse-cdn.com/elastic/original/3X/5/5/553dd4edbfe03ed84e1ad94cbd6fa798c6c17fac.png)

This is the search code

---

<div class="post-metadata">

**Author:** ![dsagent](https://avatars.discourse-cdn.com/v4/letter/d/d2c977/32.png) [@dsagent](https://discuss.elastic.co/u/dsagent)\
**Post date:** [July 13, 2024, 6:21pm UTC](https://discuss.elastic.co/t/mappings-ignore-above/363076/6 "2024-07-13T18:21:18Z")

</div>

![2024-07-13 21_13_25-172.20.10.41 - Remote Desktop Connection](https://us1.discourse-cdn.com/elastic/original/3X/0/5/05471f25428afcca1bedcb4261b68a2c50192d3f.png)

results

---

<div class="post-metadata">

**Author:** ![dsagent](https://avatars.discourse-cdn.com/v4/letter/d/d2c977/32.png) [@dsagent](https://discuss.elastic.co/u/dsagent)\
**Post date:** [July 13, 2024, 6:22pm UTC](https://discuss.elastic.co/t/mappings-ignore-above/363076/7 "2024-07-13T18:22:57Z")

</div>

Do not return the value even with the use of match

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [July 13, 2024, 6:24pm UTC](https://discuss.elastic.co/t/mappings-ignore-above/363076/8 "2024-07-13T18:24:03Z")

</div>

Apologies @dsagent ...  
Ishould have bee more clear please do not post images of text, they are hard to read, can not be reproduced, can not be debugged (copied, pasted, tested etc) and some people can not see them...

Please repost all that as text then perhaps we can help

---

<div class="post-metadata">

**Author:** ![dsagent](https://avatars.discourse-cdn.com/v4/letter/d/d2c977/32.png) [@dsagent](https://discuss.elastic.co/u/dsagent)\
**Post date:** [July 13, 2024, 6:26pm UTC](https://discuss.elastic.co/t/mappings-ignore-above/363076/9 "2024-07-13T18:26:04Z")

</div>

```auto
PUT test/_doc/1
{
  "t1":"dfsghrsgf54h6ter5j3516rt485jh6t4h51gfd3h5e476rhj874tr53e6rh4f1h6e5rh476erh15eh65er46hjt51h6ewtr7e6rth5er67h468eh435frh16ewr58jh74r6tgfhe5r1h6rte85476t8rfh15er68th9wer6th4e5wr3jh74wtr96j74rw653n4ht6w98j743sdf98j7s9frdj46gfds3j4wsartj8rt4gnj6sag5jha6gf6e9rt6h4s5rgt6y84erthy563jh6wtrehjet65reyge46h8594eq6h54etrqa356qhe986r5h4q16rt9yhet74h65t3qe5t47y6w9ry745eqrqtq54ytq69yt54rwewporueyeuye09ryhrueuy0vcumryyrvwuoelyo16431561wcgegf",
  
  "t2":"http://dfsghrsgf54h6ter5j3516rt485jh6t4h51gfd3h5e476rhj874tr53e6rh4f1h6e5rh476erh15eh65er46hjt51h6ewtr7e6rth5er67h468eh435frh16ewr58jh74r6tgfhe5r1h6rte85476t8rfh15er68th9wer6th4e5wr3jh74wtr96j74rw653n4ht6w98j743sdf98j7s9frdj46gfds3j4wsartj8rt4gnj6sag5jha6gf6e9rt6h4s5rgt6y84erthy563jh6wtrehjet65reyge46h8594eq6h54etrqa356qhe986r5h4q16rt9yhet74h65t3qe5t47y6w9ry745eqrqtq54ytq69yt54rwewporueyeuye09ryhrueuy0vcumryyrvwuoelyo16431561wcgegf",
  
  "t3":"https://testdfsghrsgf54h6ter5j3516rt485jh6t4h51gfd3h5e476rhj874tr53e6rh4f1h6e5rh476erh15eh65er46hjt51h6ewtr7e6rth5er67h468eh435frh16ewr58jh74r6tgfhe5r1h6rte85476t8rfh15er68th9wer6th4e5wr3jh74wtr96j74rw653n4ht6w98j743sdf98j7s9frdj46gfds3j4wsartj8rt4gnj6sag5jha6gf6e9rt6h4s5rgt6y84erthy563jh6wtrehjet65reyge46h8594eq6h54etrqa356qhe986r5h4q16rt9yhet74h65t3qe5t47y6w9ry745eqrqtq54ytq69yt54rwewporueyeuye09ryhrueuy0vcumryyrvwuoelyo16431561wcgegf"
}

```

---

<div class="post-metadata">

**Author:** ![dsagent](https://avatars.discourse-cdn.com/v4/letter/d/d2c977/32.png) [@dsagent](https://discuss.elastic.co/u/dsagent)\
**Post date:** [July 13, 2024, 6:26pm UTC](https://discuss.elastic.co/t/mappings-ignore-above/363076/10 "2024-07-13T18:26:41Z")

</div>

```auto
{
  "test": {
    "mappings": {
      "properties": {
        "t1": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        },
        "t2": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        },
        "t3": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        }
      }
    }
  }
}

```

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [July 13, 2024, 6:27pm UTC](https://discuss.elastic.co/t/mappings-ignore-above/363076/11 "2024-07-13T18:27:24Z")

</div>

Also are you trying to do an "Exact Match" if so you are going about it the wrong way... finish posting your text and we will fix.

You need to read about `keyword` and `term` query that is the correct approach

> **[Keyword type family | Elasticsearch Guide \[8.14\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/keyword.html)**

Typically you want to put the mapping first

AND

What is your MAX length for you data that you want to match against this can be quite large but as anything there will be some storage and performance tradeoffs at scale

And prefix / postfix your code with 3 Back Ticks

`````

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [July 13, 2024, 6:38pm UTC](https://discuss.elastic.co/t/mappings-ignore-above/363076/12 "2024-07-13T18:38:18Z")

</div>

hi @dsagent

This all works as you like

Create the Mapping first set `ignore_above` to your max value  
Notice `term` query that means exact match

```auto
DELETE discuss-test

PUT discuss-test/
{
  "mappings": {
    "properties": {
      "t1": {
        "type": "keyword",
        "ignore_above": 4096
      },
      "t2": {
        "type": "keyword",
        "ignore_above": 4096
      },
      "t3": {
        "type": "keyword",
        "ignore_above": 4096
      }
    }
  }
}

POST discuss-test/_doc
{
  "t1":"dfsghrsgf54h6ter5j3516rt485jh6t4h51gfd3h5e476rhj874tr53e6rh4f1h6e5rh476erh15eh65er46hjt51h6ewtr7e6rth5er67h468eh435frh16ewr58jh74r6tgfhe5r1h6rte85476t8rfh15er68th9wer6th4e5wr3jh74wtr96j74rw653n4ht6w98j743sdf98j7s9frdj46gfds3j4wsartj8rt4gnj6sag5jha6gf6e9rt6h4s5rgt6y84erthy563jh6wtrehjet65reyge46h8594eq6h54etrqa356qhe986r5h4q16rt9yhet74h65t3qe5t47y6w9ry745eqrqtq54ytq69yt54rwewporueyeuye09ryhrueuy0vcumryyrvwuoelyo16431561wcgegf",
  
  "t2":"http://dfsghrsgf54h6ter5j3516rt485jh6t4h51gfd3h5e476rhj874tr53e6rh4f1h6e5rh476erh15eh65er46hjt51h6ewtr7e6rth5er67h468eh435frh16ewr58jh74r6tgfhe5r1h6rte85476t8rfh15er68th9wer6th4e5wr3jh74wtr96j74rw653n4ht6w98j743sdf98j7s9frdj46gfds3j4wsartj8rt4gnj6sag5jha6gf6e9rt6h4s5rgt6y84erthy563jh6wtrehjet65reyge46h8594eq6h54etrqa356qhe986r5h4q16rt9yhet74h65t3qe5t47y6w9ry745eqrqtq54ytq69yt54rwewporueyeuye09ryhrueuy0vcumryyrvwuoelyo16431561wcgegf",
  
  "t3":"https://testdfsghrsgf54h6ter5j3516rt485jh6t4h51gfd3h5e476rhj874tr53e6rh4f1h6e5rh476erh15eh65er46hjt51h6ewtr7e6rth5er67h468eh435frh16ewr58jh74r6tgfhe5r1h6rte85476t8rfh15er68th9wer6th4e5wr3jh74wtr96j74rw653n4ht6w98j743sdf98j7s9frdj46gfds3j4wsartj8rt4gnj6sag5jha6gf6e9rt6h4s5rgt6y84erthy563jh6wtrehjet65reyge46h8594eq6h54etrqa356qhe986r5h4q16rt9yhet74h65t3qe5t47y6w9ry745eqrqtq54ytq69yt54rwewporueyeuye09ryhrueuy0vcumryyrvwuoelyo16431561wcgegf"
}
      
      
GET discuss-test/_search
{
  "query": {
    "term": {
      "t1": {
        "value": "dfsghrsgf54h6ter5j3516rt485jh6t4h51gfd3h5e476rhj874tr53e6rh4f1h6e5rh476erh15eh65er46hjt51h6ewtr7e6rth5er67h468eh435frh16ewr58jh74r6tgfhe5r1h6rte85476t8rfh15er68th9wer6th4e5wr3jh74wtr96j74rw653n4ht6w98j743sdf98j7s9frdj46gfds3j4wsartj8rt4gnj6sag5jha6gf6e9rt6h4s5rgt6y84erthy563jh6wtrehjet65reyge46h8594eq6h54etrqa356qhe986r5h4q16rt9yhet74h65t3qe5t47y6w9ry745eqrqtq54ytq69yt54rwewporueyeuye09ryhrueuy0vcumryyrvwuoelyo16431561wcgegf"
      }
    }
  }
}

# Result
#! Elasticsearch built-in security features are not enabled. Without authentication, your cluster could be accessible to anyone. See https://www.elastic.co/guide/en/elasticsearch/reference/7.17/security-minimal-setup.html to enable security.
{
  "took" : 0,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 1,
      "relation" : "eq"
    },
    "max_score" : 0.2876821,
    "hits" : [
      {
        "_index" : "discuss-test",
        "_type" : "_doc",
        "_id" : "bj9irZABfwsjeNV6fFhB",
        "_score" : 0.2876821,
        "_source" : {
          "t1" : "dfsghrsgf54h6ter5j3516rt485jh6t4h51gfd3h5e476rhj874tr53e6rh4f1h6e5rh476erh15eh65er46hjt51h6ewtr7e6rth5er67h468eh435frh16ewr58jh74r6tgfhe5r1h6rte85476t8rfh15er68th9wer6th4e5wr3jh74wtr96j74rw653n4ht6w98j743sdf98j7s9frdj46gfds3j4wsartj8rt4gnj6sag5jha6gf6e9rt6h4s5rgt6y84erthy563jh6wtrehjet65reyge46h8594eq6h54etrqa356qhe986r5h4q16rt9yhet74h65t3qe5t47y6w9ry745eqrqtq54ytq69yt54rwewporueyeuye09ryhrueuy0vcumryyrvwuoelyo16431561wcgegf",
          "t2" : "http://dfsghrsgf54h6ter5j3516rt485jh6t4h51gfd3h5e476rhj874tr53e6rh4f1h6e5rh476erh15eh65er46hjt51h6ewtr7e6rth5er67h468eh435frh16ewr58jh74r6tgfhe5r1h6rte85476t8rfh15er68th9wer6th4e5wr3jh74wtr96j74rw653n4ht6w98j743sdf98j7s9frdj46gfds3j4wsartj8rt4gnj6sag5jha6gf6e9rt6h4s5rgt6y84erthy563jh6wtrehjet65reyge46h8594eq6h54etrqa356qhe986r5h4q16rt9yhet74h65t3qe5t47y6w9ry745eqrqtq54ytq69yt54rwewporueyeuye09ryhrueuy0vcumryyrvwuoelyo16431561wcgegf",
          "t3" : "https://testdfsghrsgf54h6ter5j3516rt485jh6t4h51gfd3h5e476rhj874tr53e6rh4f1h6e5rh476erh15eh65er46hjt51h6ewtr7e6rth5er67h468eh435frh16ewr58jh74r6tgfhe5r1h6rte85476t8rfh15er68th9wer6th4e5wr3jh74wtr96j74rw653n4ht6w98j743sdf98j7s9frdj46gfds3j4wsartj8rt4gnj6sag5jha6gf6e9rt6h4s5rgt6y84erthy563jh6wtrehjet65reyge46h8594eq6h54etrqa356qhe986r5h4q16rt9yhet74h65t3qe5t47y6w9ry745eqrqtq54ytq69yt54rwewporueyeuye09ryhrueuy0vcumryyrvwuoelyo16431561wcgegf"
        }
      }
    ]
  }
}

```

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [July 13, 2024, 6:49pm UTC](https://discuss.elastic.co/t/mappings-ignore-above/363076/13 "2024-07-13T18:49:44Z")

</div>

And technically this is even faster because a filter does not score

```auto
GET discuss-test/_search
{
  "query": {
    "bool": {
      "filter": [
        {
          "term": {
            "t1": {
              "value": "dfsghrsgf54h6ter5j3516rt485jh6t4h51gfd3h5e476rhj874tr53e6rh4f1h6e5rh476erh15eh65er46hjt51h6ewtr7e6rth5er67h468eh435frh16ewr58jh74r6tgfhe5r1h6rte85476t8rfh15er68th9wer6th4e5wr3jh74wtr96j74rw653n4ht6w98j743sdf98j7s9frdj46gfds3j4wsartj8rt4gnj6sag5jha6gf6e9rt6h4s5rgt6y84erthy563jh6wtrehjet65reyge46h8594eq6h54etrqa356qhe986r5h4q16rt9yhet74h65t3qe5t47y6w9ry745eqrqtq54ytq69yt54rwewporueyeuye09ryhrueuy0vcumryyrvwuoelyo16431561wcgegf"
            }
          }
        }
      ]
    }
  }
}

```

---

<div class="post-metadata">

**Author:** ![dsagent](https://avatars.discourse-cdn.com/v4/letter/d/d2c977/32.png) [@dsagent](https://discuss.elastic.co/u/dsagent)\
**Post date:** [July 14, 2024, 8:21am UTC](https://discuss.elastic.co/t/mappings-ignore-above/363076/14 "2024-07-14T08:21:37Z")

</div>

Thank you  
I did it.  
But it repeats all three fields, I want only one of these fields.

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [July 14, 2024, 1:24pm UTC](https://discuss.elastic.co/t/mappings-ignore-above/363076/15 "2024-07-14T13:24:21Z")

</div>

@dsagent

That is because elasticsearch returns the entire document by default.

Use the `_source` or `fields` parameter to return only the fields you want

See [here](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-fields.html)

```auto
GET discuss-test/_search
{
  "_source": ["t1"], 
  "query": {
    "bool": {
      "filter": [
        {
          "term": {
            "t1": {
              "value": "dfsghrsgf54h6ter5j3516rt485jh6t4h51gfd3h5e476rhj874tr53e6rh4f1h6e5rh476erh15eh65er46hjt51h6ewtr7e6rth5er67h468eh435frh16ewr58jh74r6tgfhe5r1h6rte85476t8rfh15er68th9wer6th4e5wr3jh74wtr96j74rw653n4ht6w98j743sdf98j7s9frdj46gfds3j4wsartj8rt4gnj6sag5jha6gf6e9rt6h4s5rgt6y84erthy563jh6wtrehjet65reyge46h8594eq6h54etrqa356qhe986r5h4q16rt9yhet74h65t3qe5t47y6w9ry745eqrqtq54ytq69yt54rwewporueyeuye09ryhrueuy0vcumryyrvwuoelyo16431561wcgegf"
            }
          }
        }
      ]
    }
  }
}

```

---

<div class="post-metadata">

**Author:** ![dsagent](https://avatars.discourse-cdn.com/v4/letter/d/d2c977/32.png) [@dsagent](https://discuss.elastic.co/u/dsagent)\
**Post date:** [July 14, 2024, 2:55pm UTC](https://discuss.elastic.co/t/mappings-ignore-above/363076/16 "2024-07-14T14:55:56Z")

</div>

> [@stephenb](#):
>
> ```auto
> GET discuss-test/_search
> {
> "_source": ["t1"], 
> "query": {
> "bool": {
> "filter": [
> {
> "term": {
> "t1": {
> "value": "dfsghrsgf54h6ter5j3516rt485jh6t4h51gfd3h5e476rhj874tr53e6rh4f1h6e5rh476erh15eh65er46hjt51h6ewtr7e6rth5er67h468eh435frh16ewr58jh74r6tgfhe5r1h6rte85476t8rfh15er68th9wer6th4e5wr3jh74wtr96j74rw653n4ht6w98j743sdf98j7s9frdj46gfds3j4wsartj8rt4gnj6sag5jha6gf6e9rt6h4s5rgt6y84erthy563jh6wtrehjet65reyge46h8594eq6h54etrqa356qhe986r5h4q16rt9yhet74h65t3qe5t47y6w9ry745eqrqtq54ytq69yt54rwewporueyeuye09ryhrueuy0vcumryyrvwuoelyo16431561wcgegf"
> }
> }
> }
> ]
> }
> }
> }
> 
> ```

It worked  
Thank you
