# Pattern replace character filter and ingest attachment

**URL:** <https://discuss.elastic.co/t/pattern-replace-character-filter-and-ingest-attachment/150911>\
**Category:** Elasticsearch\
**Created:** [October 3, 2018, 3:10pm UTC](https://discuss.elastic.co/t/pattern-replace-character-filter-and-ingest-attachment/150911 "2018-10-03T15:10:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![xpico](https://avatars.discourse-cdn.com/v4/letter/x/9fc348/32.png) [@xpico](https://discuss.elastic.co/u/xpico)\
**Post date:** [October 3, 2018, 3:10pm UTC](https://discuss.elastic.co/t/pattern-replace-character-filter-and-ingest-attachment/150911/1 "2018-10-03T15:10:14Z")

</div>

Hi,

I'm using the ingest attachment plugin to extract data from pdf. I want to use `pattern_replace` character filter to change some characters from the content of pdf, but I can't get it work well.

1.- Create a pipeline

```
PUT _ingest/pipeline/atxikiak
{
  "description" : "PDFtako textuak atera",
  "processors" : [
    {
      "attachment" : {
        "field" : "data",
        "properties": ["CONTENT", "TITLE", "AUTHOR", "KEYWORDS", "CONTENT_TYPE","LANGUAGE", "DATE", "content_length"],
	      "indexed_chars": -1
      }
    }
  ]
}

```

2.- Create my index

```
PUT artxiboa
{
  "settings": {
    "analysis": {
      "analyzer": {
        "gara_analyzer": {
          "tokenizer": "standard",
          "char_filter": [
            "gara_char_filter"
          ]
        }
      },
      "char_filter": {
        "gara_char_filter": {
          "type": "pattern_replace",
          "pattern": "([a-zA-Z])-([a-zA-Z])",
          "replacement": "$1$2"
        }
      }
    }
  },
  "mappings": {
    "pdf": {
      "properties": {
        "sekzioa": { "type": "text" },
        "data_osoa": { "type": "date", "format": "yyyy-MM-dd" },
        "attachment.content" : {
            "type" : "text",
            "analyzer" : "gara_analyzer",
            "store" : true
        }
       }
     }
  }
}

```

With my char\_filter It is assumed that some-other converted in someother. But when search someother don`t find anything.

Any help please?

Thanks,

---

<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 31, 2018, 3:13pm UTC](https://discuss.elastic.co/t/pattern-replace-character-filter-and-ingest-attachment/150911/2 "2018-10-31T15:13:33Z")

</div>

Closed on October 31, 2018, 3:13pm UTC

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