# Confused about when and how asciifolding happens

**URL:** <https://discuss.elastic.co/t/confused-about-when-and-how-asciifolding-happens/4407>\
**Category:** Elasticsearch\
**Created:** [May 15, 2011, 4:46am UTC](https://discuss.elastic.co/t/confused-about-when-and-how-asciifolding-happens/4407 "2011-05-15T04:46:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chase](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chase/32/3237_2.png) [@Chase](https://discuss.elastic.co/u/Chase)\
**Post date:** [May 15, 2011, 4:46am UTC](https://discuss.elastic.co/t/confused-about-when-and-how-asciifolding-happens/4407/1 "2011-05-15T04:46:48Z")

</div>

Hello again,

In short, I'm trying to set up ElasticSearch so that it always sees  
accented characters as a fantastic opportunity for asciifolding.

I've added asciifolding to the default analyzer.

If somebody searches for "Diaz", it should match:

1. "Diaz", and
2. "Díaz"

If somebody searches for "Díaz", it should match:  
3) "Diaz", and  
4) "Díaz"

In reality, I get #1 and #2, but not #3 or, quite surprisingly, #4.  
Why not?

See [https://gist.github.com/972878](https://gist.github.com/972878)

In fact, even with default settings, "Díaz" does not seem to match  
"Díaz". Maybe this is a problem with the Mac OS X Terminal I'm using?

A related question I have is that if I create a custom analyzer with  
asciifolding and specify it in a mapping, but I don't have  
asciifolding in the default analyzer, then I only get the benefit of  
asciifolding when doing searches on specific fields. In the above  
example, if asciifolding was enabled for the name field in its  
mapping, then the query "name:diaz" would match "Cameron Díaz", but a  
query of "diaz" would not. I sort of understand this as a design  
choice, but at the same time, it would be nice (in a principle-of-  
least-surprise way) if the filters on a field were always active, no  
matter how you're searching it. Intuitively, I assumed that when  
asciifolding was turned on, it would tokenize "Díaz" as "diaz" -- but  
evidently, not so? Should I be doing something differently?

Thanks in advance,  
-Chase

---

<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:** [July 6, 2017, 4:06am UTC](https://discuss.elastic.co/t/confused-about-when-and-how-asciifolding-happens/4407/2 "2017-07-06T04:06:14Z")

</div>


