Special Characters in Query String

Hi, I'm having trouble trying to search special characters using query string. I need to search an email address in format "xxx@xxx.xxx". At index time I use a custom normalizer which provide lowercase and ascii folding. At search time I use a custom analyzer which provide a tokenizer for whitespace and a filter that apply lowercase and ascii folding. By the way I am not able to search for a simple email address.

This is my mapping

{
    "settings": {
        "number_of_shards": 5,
        "number_of_replicas": 1,
        "analysis": {
            "analyzer": {
                "folding": {
                    "tokenizer": "whitespace",
                    "filter": [
                        "lowercase",
                        "asciifolding"
                    ]
                }
            },
            "normalizer": {
                "lowerasciinormalizer": {
                    "type": "custom",
                    "filter": [
                        "lowercase",
                        "asciifolding"
                    ]
                }
            }
        }
    },
    "mappings": {
        "properties": {
            "id": {
                "type": "integer"
            },
           "email": {
                "type": "keyword",
                "normalizer": "lowerasciinormalizer"
            }
    }
}

And this is my search query

{
    "query": {
        "bool": {
            "must": [
                {
                    "query_string": {
                        "query": "pippo@pluto.it",
                        "fields": [
                            "email"
                        ],
                        "analyzer": "folding"
                    }
                }
            ]
        }
    }
}

Searching without special characters works fine. Infact if I do "query": "pippo*" I get the correct results.
I also tested the tokenizer doing
GET /_analyze

{
  "analyzer": "whitespace",
  "text": "pippo@pluto.com"
}

I get what I expect

{
  "tokens" : [
    {
      "token" : "pippo@pluto.com",
      "start_offset" : 0,
      "end_offset" : 15,
      "type" : "word",
      "position" : 0
    }
  ]
}

Any suggestions?
Thanks.

The problem was not in the analyzer. I have a problem in other fields mapping. This query works good.

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