技術情報

ElasticSearchで”Text”の大文字、小文字を区別しない設定

参考
http://qiita.com/talefantasia/items/9f1e31646cb9a69956c4

mappings_xxx.json
{
   "settings" : {
     "analysis" : {
       "filter" : {
         "greek_lowercase_filter" : {type : "lowercase", language : "greek"}
       },
       "analyzer" : {
         "ja-ma-analyzer" : {
           "type" : "custom",
           "tokenizer" : "ja-ma-tokenizer",
           "filter" : ["kuromoji_baseform", "greek_lowercase_filter", "cjk_width"]
         },
         "ja-2gram-analyzer" : {
           "type" : "custom",
           "tokenizer" : "ja-2gram-tokenizer"
         }
       },
       "tokenizer" : {
         "ja-ma-tokenizer" : {
           "type" : "kuromoji_tokenizer",
           "mode" : "normal"
         },
         "ja-2gram-tokenizer" : {
           "type" : "nGram",
           "min_gram" : "2",
           "max_gram" : "2"
         }
       }
     }
   },
   "mappings" : {
     "*" : {
       "properties" : {
         "Name" : {
           "type" : "multi_field",
           "fields": {
             "Name" : {
               "type"  : "string",
               "index" : "not_analyzed"
             },
             "full": {
               "type"  : "string",
               "index" : "analyzed"
             }
           }
         },
         "Text" : {
           "type" : "multi_field",
           "fields": {
             "Text" : {
               "type"  : "string",
               "analyzer" : "ja-ma-analyzer"
             },
             "full": {
               "type"  : "string",
               "index" : "analyzed"
             }
           }
         }
       }
     }
   }
}

Leave a Reply

Your email address will not be published.

日本語が含まれない投稿は無視されますのでご注意ください。(スパム対策)