-
-
Save syllogismos/c2dde4f097fea149e1a0 to your computer and use it in GitHub Desktop.
default index template with all default settings for snapdeal cluster
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
PUT request to /_template/default_template with below body.. | |
remove comments, it won't work.. comments are for clarification.. | |
*/ | |
{ | |
"template": "*", | |
"settings": { | |
"number_of_shards": 2, // default number of shards is set to 2 | |
"index": { | |
"analysis": { | |
"analyzer": { // Custom Analyzer with keyword tokenizer and lowercase filter, same as not_analyzed but case insensitive | |
"case_insensitive_keyword_analyzer": { | |
"tokenizer": "keyword", | |
"filter": "lowercase" | |
} | |
} | |
} | |
} | |
}, | |
"mappings": { | |
"datapoints": { | |
"dynamic_templates": [ // dynamic template the makes all string fields behave like multifield, with one field not_analyzed, and another use our custom analyzer | |
{ | |
"default_string_field_mapping": { | |
"mapping": { | |
"type": "multi_field", | |
"fields": { | |
"{name}": { // default analyzer.. not_analyzed.. | |
"type": "string", | |
"index": "not_analyzed" | |
}, | |
"case_insensitive": { // name.case_insensitive.. to get case insensitive keyword analyzer | |
"type": "string", | |
"index": "analyzed", | |
"analyzer": "case_insensitive_keyword_analyzer" | |
} | |
} | |
}, | |
"match_mapping_type": "string", | |
"match": "*" | |
} | |
} | |
], | |
"_all": { // we can disable _all, we don't need that.. | |
"enabled": false | |
} | |
} | |
}, | |
"aliases": { // every index will have a default index alias, whose name gets -alias appeneded to it.. | |
"{index}-alias": {} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
PUT requests to /_template/name_of_the_template | |
*/ | |
////////////////// number_of_shards_template //////////////////////////// | |
/* | |
PUT request to /_template/default_number_of_shards_template | |
*/ | |
{ | |
"template": "*", | |
"settings": { | |
"number_of_shards": 2 | |
} | |
} | |
/////////////////////////////////////////////////////////////////////// | |
///////////////// index-alias template //////////////////////////////// | |
/* | |
PUT request to /_template/index_aliases_template | |
*/ | |
{ | |
"template": "*", | |
"aliases": { | |
"{index}-alias": {} | |
} | |
} | |
////////////////////////////////////////////////////////////////////// | |
///////////////// default datapoints mapping template ///////////////// | |
/* | |
PUT request to /_template/default_datapoints_mapping_template | |
*/ | |
{ | |
"template": "*", | |
"settings": { | |
"index": { | |
"analysis": { | |
"analyzer": { | |
"case_insensitive_keyword_analyzer": { | |
"tokenizer": "keyword", | |
"filter": "lowercase" | |
} | |
} | |
} | |
} | |
}, | |
"mappings": { | |
"datapoints": { | |
"dynamic_templates": [ | |
{ | |
"string_not_analyzed": { | |
"mapping": { | |
"type": "multi_field", | |
"fields": { | |
"{name}": { | |
"type": "string", | |
"index": "not_analyzed" | |
}, | |
"case_insensitive": { | |
"type": "string", | |
"index": "analyzed", | |
"analyzer": "case_insensitive_keyword_analyzer" | |
} | |
} | |
}, | |
"match_mapping_type": "string", | |
"match": "*" | |
} | |
} | |
], | |
"_all": { | |
"enabled": false | |
} | |
} | |
} | |
} | |
///////////////////////////////////////////////////////////////////////////////////// |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment