Whitespace tokenizer doesn't allow lowercase search?


(John Jack) #1

Hello,

I want to use the whitespace tokenizer and be able to have my search be case insensitive.

However, I am unable to do case insensitive searches when using the whitespace tokenizer. This is what my settings look like ...

"analysis": {
"analyzer": {
"default": {
"filter": "lowercase",
"type": "whitespace",
"tokenizer": "whitespace"
}
}
}

What am I doing wrong? What should I do to fix it?

Thanks.


(Martijn Van Groningen) #2

In your analyzer config type should be set to custom and you should use a different name than default (default is already an built-in analyzer):

“analysis”: {
   “analyzer”: {
      “my_analyzer”: {
         "type":  "custom",
         “tokenizer”: “whitespace”,
         “filter”: “lowercase”
      }
  }
}

Then in the mapping you can set the analyzer option to my_analyzer on text fields.

Also you don't need an custom analyzer for this, I think just using the built-in simple analyzer does the same thing. The only thing you need to do is set the analyzer option to simple on a text field.


(system) #3

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