Reverting back to 0.90.7 config/templates loading behaviour

Closes #4511
This commit is contained in:
Alexander Reelsen 2013-12-20 14:58:46 +01:00
parent bbffeb1b39
commit 0bef2c66a9
5 changed files with 22 additions and 16 deletions

View File

@ -482,7 +482,7 @@ public class MetaDataCreateIndexService extends AbstractComponent {
try { try {
byte[] templatesData = Streams.copyToByteArray(templatesFile); byte[] templatesData = Streams.copyToByteArray(templatesFile);
parser = XContentHelper.createParser(templatesData, 0, templatesData.length); parser = XContentHelper.createParser(templatesData, 0, templatesData.length);
IndexTemplateMetaData template = IndexTemplateMetaData.Builder.fromXContent(parser); IndexTemplateMetaData template = IndexTemplateMetaData.Builder.fromXContentStandalone(parser);
if (Regex.simpleMatch(template.template(), request.index)) { if (Regex.simpleMatch(template.template(), request.index)) {
templates.add(template); templates.add(template);
} }

View File

@ -58,7 +58,7 @@ public class IndexTemplateFileLoadingTests extends ElasticsearchIntegrationTest
File dst = new File(templatesDir, "template.json"); File dst = new File(templatesDir, "template.json");
// random template, one uses the 'setting.index.number_of_shards', the other 'settings.number_of_shards' // random template, one uses the 'setting.index.number_of_shards', the other 'settings.number_of_shards'
String template = Streams.copyToStringFromClasspath("/org/elasticsearch/indices/template/template" + randomInt(1) + ".json"); String template = Streams.copyToStringFromClasspath("/org/elasticsearch/indices/template/template" + randomInt(2) + ".json");
Files.write(template, dst, Charsets.UTF_8); Files.write(template, dst, Charsets.UTF_8);
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e); throw new RuntimeException(e);

View File

@ -1,7 +1,9 @@
{ {
"template" : "foo*", "template_1" : {
"settings" : { "template" : "foo*",
"index.number_of_shards": 10, "settings" : {
"index.number_of_replicas": 0 "index.number_of_shards": 10,
} "index.number_of_replicas": 0
}
}
} }

View File

@ -1,7 +1,9 @@
{ {
"template" : "foo*", "template_1" : {
"settings" : { "template" : "foo*",
"number_of_shards": 10, "settings" : {
"number_of_replicas": 0 "number_of_shards": 10,
"number_of_replicas": 0
}
} }
} }

View File

@ -1,9 +1,11 @@
{ {
"template" : "foo*", "template_1" : {
"settings" : { "template" : "foo*",
"index" : { "settings" : {
"number_of_shards": 10, "index" : {
"number_of_replicas": 0 "number_of_shards": 10,
"number_of_replicas": 0
}
} }
} }
} }