Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Elasticsearch - configure lowercase analyzer with no tokenizer

Is there a way to configure an analyzer that will only lower case the input before indexing?

So for example if I get:

"name": "Foo Bar"

The output term should be "foo bar", so I can use a term query to query that exact term.

My use case is to index an entity that I am going to query later with a term query, so I want every thing to be index after lowercased.

Thanks!

like image 240
Tomer Avatar asked Dec 07 '15 15:12

Tomer


1 Answers

Ok, found it!

Looks like the keyword tokenizer is the right tokenizer to use.

"analysis": {
  "analyzer": {
    "lowercase": {
      "type": "custom",
      "tokenizer": "keyword",
      "filter": [
        "lowercase"
      ]
    }
  }
}
like image 175
Tomer Avatar answered Nov 24 '22 22:11

Tomer