Tomer
Tomer

Reputation: 2448

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!

Upvotes: 6

Views: 3738

Answers (1)

Tomer
Tomer

Reputation: 2448

Ok, found it!

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

"analysis": {
  "analyzer": {
    "lowercase": {
      "type": "custom",
      "tokenizer": "keyword",
      "filter": [
        "lowercase"
      ]
    }
  }
}

Upvotes: 7

Related Questions