Skip to content

Instantly share code, notes, and snippets.

@yoshi0309 yoshi0309/mapping.json
Last active Aug 29, 2015

Embed
What would you like to do?
Dynamic mapping template for Elasticsearch 1.3.2
{
"settings" : {
"index" : {
"analysis" : {
"analyzer" : {
"unigram" : {
"tokenizer" : "unigram_tokenizer"
},
"bigram" : {
"tokenizer" : "bigram_tokenizer"
}
},
"tokenizer" : {
"unigram_tokenizer" : {
"type" : "nGram",
"min_gram" : "1",
"max_gram" : "2",
"token_chars": [ "letter", "digit", "whitespace", "punctuation", "symbol"]
},
"bigram_tokenizer" : {
"type" : "nGram",
"min_gram" : "2",
"max_gram" : "3",
"token_chars": [ "letter", "digit"]
}
}
}
}
},
"mappings" : {
"article" : {
"dynamic_templates" : [
{
"template_integer" : {
"match" : "*_i",
"mapping" : { "type" : "integer", "index" : "analyzed", "stored" : "true"}
}
},
{
"template_integer_multi" : {
"match" : "*_is",
"mapping" : { "type" : "integer", "index" : "analyzed", "stored" : "true", "position_offset_gap": 100}
}
},
{
"template_string" : {
"match" : "*_s",
"mapping" : { "type" : "string", "index" : "analyzed", "stored" : "true"}
}
},
{
"template_string_multi" : {
"match" : "*_ss",
"mapping" : { "type" : "string", "index" : "analyzed", "stored" : "true", "position_offset_gap": 100}
}
},
{
"template_long" : {
"match" : "*_l",
"mapping" : { "type" : "long", "index" : "analyzed", "stored" : "true"}
}
},
{
"template_long_multi" : {
"match" : "*_ls",
"mapping" : { "type" : "long", "index" : "analyzed", "stored" : "true", "position_offset_gap": 100}
}
},
{
"template_text" : {
"match" : "*_t",
"mapping" : { "type" : "string", "index" : "analyzed", "stored" : "true", "analyzer" : "standard"}
}
},
{
"template_text_multi" : {
"match" : "*_txt",
"mapping" : { "type" : "string", "index" : "analyzed", "stored" : "true", "position_offset_gap": 100, "analyzer" : "standard"}
}
},
{
"template_text_multi_en" : {
"match" : "*_en",
"mapping" : { "type" : "string", "index" : "analyzed", "stored" : "true", "position_offset_gap": 100, "analyzer" : "snowball"}
}
},
{
"template_boolean" : {
"match" : "*_b",
"mapping" : { "type" : "boolean", "index" : "analyzed", "stored" : "true"}
}
},
{
"template_boolean_multi" : {
"match" : "*_bs",
"mapping" : { "type" : "boolean", "index" : "analyzed", "stored" : "true", "position_offset_gap": 100}
}
},
{
"template_float" : {
"match" : "*_f",
"mapping" : { "type" : "float", "index" : "analyzed", "stored" : "true"}
}
},
{
"template_float_multi" : {
"match" : "*_fs",
"mapping" : { "type" : "float", "index" : "analyzed", "stored" : "true", "position_offset_gap": 100}
}
},
{
"template_double" : {
"match" : "*_d",
"mapping" : { "type" : "double", "index" : "analyzed", "stored" : "true"}
}
},
{
"template_double_multi" : {
"match" : "*_ds",
"mapping" : { "type" : "double", "index" : "analyzed", "stored" : "true", "position_offset_gap": 100}
}
},
{
"template_date" : {
"match" : "*_dt",
"mapping" : { "type" : "date", "index" : "analyzed", "stored" : "true"}
}
},
{
"template_date_multi" : {
"match" : "*_dts",
"mapping" : { "type" : "date", "index" : "analyzed", "stored" : "true", "position_offset_gap": 100}
}
},
{
"template_unigram" : {
"match" : "*_u",
"mapping" : { "type" : "string", "index" : "analyzed", "stored" : "true", "analyzer" : "unigram"}
}
},
{
"template_unigram" : {
"match" : "*_ja",
"mapping" : { "type" : "string", "index" : "analyzed", "stored" : "true", "analyzer" : "kuromoji"}
}
}
]
}
}
}
@yoshi0309

This comment has been minimized.

Copy link
Owner Author

commented Sep 3, 2014

  • you would need to change type name 'article' on line 31.
  • POST /{index_name} -D @mapping.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.