Elasticsearch Template from JSON file


(sreeram) #1

Hi,

I'm using Elasticsearch-2.3.4 in windows server machine and trying import global template (for all index) from "default-template.json" file instead of using XPUT .

I've placed the file "default-template.json" file in ..\config\templates folder and restarted elasticsearch service but on indexing new documents (dynamic mapping) I'm not able to see any impact of global template defined.

Below is the content of "default-template.json" file,

{
"_template" :
{
"template" : "",
"settings":{
"index":{
"analysis":{
"analyzer":{
"analyzer_keyword":{
"tokenizer":"keyword",
"filter":"lowercase"
}
}
}
}
},
"mappings": {
"default": {
"numeric_detection": true,
"dynamic_templates": [
{
"string_analyzer": {
"match_mapping_type": "string",
"match": "
",
"mapping": {
"type": "string",
"analyzer":"analyzer_keyword"
}
}
}
]
}
}
}
}

Am I missing something ?

Regards
Sreeram


(Mark Walkom) #2

Yep, see https://www.elastic.co/guide/en/elasticsearch/reference/2.3/breaking_20_mapping_changes.html#_mappings_in_config_files_not_supported


(Jun Ohtani) #3

See
https://www.elastic.co/guide/en/elasticsearch/reference/2.0/breaking_20_index_api_changes.html#_file_based_index_templates


(sreeram) #4

Got it, Thanks :slight_smile:


(sreeram) #5

Thanks :slight_smile:


(system) #6