# Help with ASCIIfolding

**URL:** <https://discuss.elastic.co/t/help-with-asciifolding/42306>\
**Category:** Elasticsearch\
**Created:** [February 20, 2016, 12:49pm UTC](https://discuss.elastic.co/t/help-with-asciifolding/42306 "2016-02-20T12:49:54Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![basiclaser](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/basiclaser/32/23304_2.png) [@basiclaser](https://discuss.elastic.co/u/basiclaser)\
**Post date:** [February 20, 2016, 12:49pm UTC](https://discuss.elastic.co/t/help-with-asciifolding/42306/1 "2016-02-20T12:49:54Z")

</div>

I'm attempting to add an 'asciifolding' field to my title field, and have tried various examples, signatures and syntaxes, but they all seem to fail. Is asciifolding deprecated or something? thanks.

```auto
PUT /my_index
{
    "settings": { "number_of_shards": 1 }, 
    "mappings": {
        "my_type": {
            "properties": {
                "title": { 
                    "type": "string",
                    "analyzer": "english",
                    "fields": {
                        "std": { 
                            "type": "string",
                            "analyzer": "standard"
                        },                        
                        "fold": { 
                          "type": "string",
                          "tokenizer": "standard",
                          "filter": ["lowercase", "asciifolding"]
                        }
                    }
                }
            }
        }
    }
}

```

error message:

```auto
{
   "error": {
      "root_cause": [
         {
            "type": "mapper_parsing_exception",
            "reason": "Mapping definition for [fields] has unsupported parameters: [filter : [lowercase, asciifolding]] [tokenizer : standard]"
         }
      ],
      "type": "mapper_parsing_exception",
      "reason": "Failed to parse mapping [my_type]: Mapping definition for [fields] has unsupported parameters: [filter : [lowercase, asciifolding]] [tokenizer : standard]",
      "caused_by": {
         "type": "mapper_parsing_exception",
         "reason": "Mapping definition for [fields] has unsupported parameters: [filter : [lowercase, asciifolding]] [tokenizer : standard]"
      }
   },
   "status": 400
}

```

---

<div class="post-metadata">

**Author:** ![basiclaser](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/basiclaser/32/23304_2.png) [@basiclaser](https://discuss.elastic.co/u/basiclaser)\
**Post date:** [February 20, 2016, 12:58pm UTC](https://discuss.elastic.co/t/help-with-asciifolding/42306/2 "2016-02-20T12:58:04Z")

</div>

Ah! interestingly there seems to be no issue in this case where the 'mappings' wrapping field is omitted:

```auto
PUT /my_index/
{
  "my_type": {
    "properties": {
      "title": { 
        "type": "string",
        "analyzer": "english",
        "fields": {
          "folded": { 
            "type": "string",
            "analyzer": "asciifolding"
          },
          "std": { 
              "type": "string",
              "analyzer": "standard"
          }
        }
      }
    }
  }
}

```

---

<div class="post-metadata">

**Author:** ![basiclaser](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/basiclaser/32/23304_2.png) [@basiclaser](https://discuss.elastic.co/u/basiclaser)\
**Post date:** [February 20, 2016, 1:34pm UTC](https://discuss.elastic.co/t/help-with-asciifolding/42306/3 "2016-02-20T13:34:06Z")

</div>

I'm still having issues applying asciifolding to types.  
take the following simple code:

```auto
DELETE /my_index/
PUT /my_index/
PUT /my_index/_mapping/my_type
{
  "settings": { "number_of_shards": 1 }, 
  "properties": {
    "title": { 
      "type": "string",
      "analyzer": "standard",
      "fields": {
        "folded": { 
          "type": "string",
          "analyzer": "asciifolding"
        },
        "std": { 
              "type": "string",
              "analyzer": "standard"
        }
      }
    }
  }
}

PUT /my_index/my_type/5
{ "title": "Esta loca!" }
PUT /my_index/my_type/6
{ "title": "Está loca!" }

GET /my_index/_validate/query?explain
{
  "query": {
    "multi_match": {
      "type": "most_fields",
      "query": "está loca",
      "fields": ["title", "title.folded"]
    }
  }
}

```

Is there a reason i can't apply asciifolding to a field? here is the error ( it failed on line 3 ):

```auto
{
   "error": {
      "root_cause": [
         {
            "type": "mapper_parsing_exception",
            "reason": "analyzer [asciifolding] not found for field [folded]"
         }
      ],
      "type": "mapper_parsing_exception",
      "reason": "analyzer [asciifolding] not found for field [folded]"
   },
   "status": 400
}

```

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [February 20, 2016, 3:29pm UTC](https://discuss.elastic.co/t/help-with-asciifolding/42306/4 "2016-02-20T15:29:43Z")

</div>

asciifolding is not an analyzer but a token filter.

What you want to do is something like this:

```auto
DELETE index
PUT index
{
  "settings": {
    "analysis": {
      "analyzer": {
        "my_analyzer": {
          "tokenizer": "standard",
          "filter": ["lowercase", "asciifolding"]
        }
      }
    }
  },
  "mappings": {
    "my_type": {
      "properties": {
        "foo": {
          "type": "string",
          "analyzer": "my_analyzer"
        }
      }
    }
  }
}

```

---

<div class="post-metadata">

**Author:** ![basiclaser](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/basiclaser/32/23304_2.png) [@basiclaser](https://discuss.elastic.co/u/basiclaser)\
**Post date:** [March 10, 2016, 4:55pm UTC](https://discuss.elastic.co/t/help-with-asciifolding/42306/5 "2016-03-10T16:55:32Z")

</div>

Hi there Dadoonet,  
Thanks for your help. It got me going in the right direction, and now I'm at the point where things are successfully indexing, but the the asciifolding does not seem to be taking effect. If you wouldn't mind, please take a look at my settings, mapping and query.

```auto
      {
        settings: {
          analysis: {
            filter: {
              min_eng: {
                type: 'stemmer',
                name: 'english',
                // name: 'minimal_english',
              },
            },
            analyzer: {
              sensible_analyzer: {
                tokenizer: 'standard',
                filter: [
                  'min_eng',
                  'asciifolding',
                  'lowercase',
                ],
              },
            },
          },
        },
      }

```

.. mapping:

````auto
      type: String,
      required: true,
      es_indexed: true,
      analyzer: 'sensible_analyzer',
      search_analyzer: 'sensible_analyzer',
    },
```
and finally my simple query: 

````

```
  multi_match: {
    query: this.query.q,
    fields: ['title', 'authors.name'],
    cutoff_frequency: 0.0007, // https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-common-terms-query.html#_examples_3
  },

```

```auto

And so.. If I query for 'andré' with this setup, I receive results containing 'André', but if I omit the 'é' and just search 'andre' or 'Andre', I get no results. 
Any ideas? Thanks a lot.
```

---

<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 5, 2017, 11:09pm UTC](https://discuss.elastic.co/t/help-with-asciifolding/42306/6 "2017-07-05T23:09:24Z")

</div>


