# Remove the number from the field, and only remain letter

**URL:** https://discuss.elastic.co/t/remove-the-number-from-the-field-and-only-remain-letter/284548
**Category:** Elasticsearch
**Created:** [September 18, 2021, 7:10pm UTC](https://discuss.elastic.co/t/remove-the-number-from-the-field-and-only-remain-letter/284548 "2021-09-18T19:10:29Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![zaidsalah](https://avatars.discourse-cdn.com/v4/letter/z/e19adc/32.png) [@zaidsalah](https://discuss.elastic.co/u/zaidsalah)
#### Post date: [September 18, 2021, 7:10pm UTC](https://discuss.elastic.co/t/remove-the-number-from-the-field-and-only-remain-letter/284548/1 "2021-09-18T19:10:29Z")

</div>

remove the number from the field, only I want letter . in my PDF have table contain name and id, id is number when I index and using ingest attachment pipeline number will store as well like this

```auto
id name
123 user one
132 user two

```

what i want only to store name (user one and user two)

---

<div class="post-metadata">

### Author: ![aaron-nimocks](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aaron-nimocks/32/73965_2.png) [@aaron-nimocks](https://discuss.elastic.co/u/aaron-nimocks)
#### Post date: [September 18, 2021, 7:35pm UTC](https://discuss.elastic.co/t/remove-the-number-from-the-field-and-only-remain-letter/284548/2 "2021-09-18T19:35:51Z")

</div>

You have an `_id` field which is required. If you are talking about another field called `id` that you want removed then you can use the [remove processor](https://www.elastic.co/guide/en/elasticsearch/reference/master/remove-processor.html) in your ingest pipeline.

```auto
{
  "remove": {
    "field": "id"
  }
}

```

---

<div class="post-metadata">

### Author: ![zaidsalah](https://avatars.discourse-cdn.com/v4/letter/z/e19adc/32.png) [@zaidsalah](https://discuss.elastic.co/u/zaidsalah)
#### Post date: [September 18, 2021, 7:54pm UTC](https://discuss.elastic.co/t/remove-the-number-from-the-field-and-only-remain-letter/284548/3 "2021-09-18T19:54:39Z")

</div>

no this name and id in my pdf,i am send this pdf as base64, and in attachment.content this number will store as well, i want only to store character in attachment.content not this number

mean in attachment.content i have all this ( id name 123 user one 132 user two) i want only character like this in this field ( id name user one user two)

---

<div class="post-metadata">

### Author: ![aaron-nimocks](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aaron-nimocks/32/73965_2.png) [@aaron-nimocks](https://discuss.elastic.co/u/aaron-nimocks)
#### Post date: [September 18, 2021, 8:08pm UTC](https://discuss.elastic.co/t/remove-the-number-from-the-field-and-only-remain-letter/284548/4 "2021-09-18T20:08:32Z")

</div>

Can you show me the expected result using JSON? I am still not sure. Here is what the input looks like.

**Input**

```auto
{
 "id": 123,
 "name": "user one"
},
{
 "id": 132,
 "name": "user two"
}

```

---

<div class="post-metadata">

### Author: ![zaidsalah](https://avatars.discourse-cdn.com/v4/letter/z/e19adc/32.png) [@zaidsalah](https://discuss.elastic.co/u/zaidsalah)
#### Post date: [September 18, 2021, 8:40pm UTC](https://discuss.elastic.co/t/remove-the-number-from-the-field-and-only-remain-letter/284548/5 "2021-09-18T20:40:37Z")

</div>

![problem](https://us1.discourse-cdn.com/elastic/original/3X/e/b/eb9424881f366243bff60c46446b8dd643cde797.png)  
this is is my table in pdf and I want to index the content(text) of the pdf. I have installed ingest attachment processor, it will convert base64 to text that is searchable, it will store to attachment.content like this ( name id user one 123 user two 132) as a text, what I want only I want a text for this field (attachment. content). I need something for this field like a simple analyzer the only allow letter,  
when i want to search for it, this given

```auto
"_index" : "myIndex",
        "_type" : "_doc",
        "_id" : "vtvp-XsBs542oOi7VWgr",
        "_score" : 1.0,
        "_source" : {
          "attachment" : {
            "content" : """
            name id user one 123 user two 132
            """
                            },
        }
      }

```

content is name id user one 123 user two 132 , but i want to remove this number

---

<div class="post-metadata">

### Author: ![aaron-nimocks](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aaron-nimocks/32/73965_2.png) [@aaron-nimocks](https://discuss.elastic.co/u/aaron-nimocks)
#### Post date: [September 19, 2021, 10:23am UTC](https://discuss.elastic.co/t/remove-the-number-from-the-field-and-only-remain-letter/284548/6 "2021-09-19T10:23:35Z")

</div>

I think I know what you mean now. There could be an easier way but this is the first solution I thought of.

1. Remove all numbers
2. Clean up the double spaces it causes
3. Trim up spaces if numbers were at the front or end

```auto
POST _ingest/pipeline/_simulate
{
  "pipeline": {
    "description": "describe pipeline",
    "processors": [
      {
        "gsub": {
          "field": "message",
          "pattern": "[0-9]",
          "replacement": ""
        }
      },
      {
        "gsub": {
          "field": "message",
          "pattern": " ",
          "replacement": " "
        }
      },
      {
        "trim": {
          "field": "message"
        }
      }
    ]
  },
  "docs": [
    {
      "_source": {
        "message": "name id user one 123 user two 132"
      }
    }
  ]
}

```

**Output**

```auto
"message" : "name id user one user two"

```

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [October 17, 2021, 10:23am UTC](https://discuss.elastic.co/t/remove-the-number-from-the-field-and-only-remain-letter/284548/7 "2021-10-17T10:23:43Z")

</div>

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