Paul
Paul

Reputation: 858

How to add lowercase indexing to snowball analyzer for ElasticSearch

I'm using the default snowball analyzer in ElasticSearch

indexes :theme do
  indexes :name, analyzer: 'snowball', index: "not_analyzed"
end

Now i'd only like the server to index 'themes' as lowercase.

I should be able to this with "filter": "lowercase", but i do not know how to add this to the existing :snowball".

Upvotes: 0

Views: 164

Answers (1)

Kumar Kailash
Kumar Kailash

Reputation: 1395

You could first create a settings over the index and you can specify the filter through this settings in your mapping.

curl -XPOST 'localhost:9200/index_name' -d '{
"settings" : {
    "index": {
      "analysis" : {
        "analyzer" : {
          "lowercaseAnalyzer": {
            "type": "snowball",
            "tokenizer": "keyword",
            "language" : "English", 
            "filter": ["lowercase"]
          }
        }
      }
    }
   }
}'

Now try applying this settings to your field in the mapping

                 "name":{
                    "type":"string",
                    "analyzer":"lowercaseAnalyzer"
                 }

Upvotes: 1

Related Questions