# Accent issue on search - ES 5.0

**URL:** <https://discuss.elastic.co/t/accent-issue-on-search-es-5-0/65500>\
**Category:** Elasticsearch\
**Created:** [November 9, 2016, 1:49pm UTC](https://discuss.elastic.co/t/accent-issue-on-search-es-5-0/65500 "2016-11-09T13:49:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![evert](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/evert/32/8143_2.png) [@evert](https://discuss.elastic.co/u/evert)\
**Post date:** [November 9, 2016, 1:49pm UTC](https://discuss.elastic.co/t/accent-issue-on-search-es-5-0/65500/1 "2016-11-09T13:49:06Z")

</div>

**Problem:** I can not find the correct settings (ES5) to query a term as _"prodigo"_ and return all occurencies of _"prodigo"_ and **"pródigo"** , word which has an accent.

**Enviornment:**

I am upgrading from ES 2.4 to ES 5.0. In my current cenário this is my mapping:

```
'properties' => [
    'file' => [
        'type' => 'attachment',
        'fields' => [
            'content' => [
                'type' => 'string',
                'term_vector' => 'with_positions_offsets',
                'store' => true,
                'analyzer' => 'brazilian'
            ]
        ]
    ],
    'book_name' => [
        'type' => 'string',
        'analyzer' => 'brazilian'
    ],
    'book_author' => [
        'type' => 'string',
        'analyzer' => 'brazilian'
    ],
    'book_editor' => [
        'type' => 'string'
    ],
    'url' => [
        'type' => 'string'
    ]
]

```

This settings does a little trick for me today, when looking for a term without _accent_ it searches for all the words in Portuguese universe which could have accent as well.

So, in my new settings for ES 5.0 I have:

```
'properties' => [
    'name' => [
        'type' => 'text',
        'analyzer' => 'brazilian'
    ],
    'author' => [
        'type' => 'text',
        'analyzer' => 'brazilian'
    ],
    'editor' => [
        'type' => 'text',
        'analyzer' => 'brazilian'
    ],
    'url' => [
        'type' => 'text'
    ],
    'content' => [
        'type' => 'text',
        'analyzer' => 'brazilian',
        'term_vector' => 'with_positions_offsets',
        'store' => true
    ]
]

```

But it´s not doing the _trick_ anymore... I have read a lot on the docs, and unfortunately, the [page which has found the previous solutions has not been updated yet](https://www.elastic.co/guide/en/elasticsearch/guide/master/asciifolding-token-filter.html).

So, I have tried these:

```
'analyzer' => [
    'brazilian' => [
        'tokenizer' => 'standard',
        'filter' => [
            'standard',
            'lowercase',
            'asciifolding'
        ]
    ]
]

```

With some variations as well... a lot variations... and still could not make it work. Also tried the [Language Analyzers for Brazilian Portuguese](https://www.elastic.co/guide/en/elasticsearch/reference/5.0/analysis-lang-analyzer.html#brazilian-analyzer) and still not getting it solved.

The processor I am using to ingest my pdf files content is:

```
{
    "description": "Extract attachment information",
    "processors": {
        {
            "attachment": {
                "field": "content",
                "indexed_chars": -1
            }                        
        },
    }
}

```

My query is like this:

```
'query' => [
    'match_phrase' => [
        'content' => [
            'query' => '(MY_SEARCH_STRING - EX. prodigo)',
            'slop' => 15
        ]
    ]
]

```

Any help will be appreciated.

P.S.: All codes are in Array formats because I am using PHP Client.

---

<div class="post-metadata">

**Author:** ![evert](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/evert/32/8143_2.png) [@evert](https://discuss.elastic.co/u/evert)\
**Post date:** [November 11, 2016, 8:02am UTC](https://discuss.elastic.co/t/accent-issue-on-search-es-5-0/65500/2 "2016-11-11T08:02:18Z")

</div>

When using ingest attachment the field which should be filtered is the "processor" field, in this case the **attachment.content** , as of cleared by @dadoonet in [here](https://github.com/elastic/elasticsearch/issues/21486).

So, my mapping should have the below under _content_:

```
{ 
    "mappings" : { 
        "docs" : { 
            "properties" : { 
                "attachment.content" : { 
                    "type": "text", 
                    "analyzer" : "brazilian" 
                } 
            } 
        } 
    } 
} 

```

Sorry my mistake...!

---

<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:** [December 9, 2016, 8:02am UTC](https://discuss.elastic.co/t/accent-issue-on-search-es-5-0/65500/3 "2016-12-09T08:02:33Z")

</div>

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