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 {
byte[] templatesData = Streams.copyToByteArray(templatesFile);
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)) {
templates.add(template);
}

View File

@ -58,7 +58,7 @@ public class IndexTemplateFileLoadingTests extends ElasticsearchIntegrationTest
File dst = new File(templatesDir, "template.json");
// 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);
} catch (Exception e) {
throw new RuntimeException(e);

View File

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

View File

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

View File

@ -1,4 +1,5 @@
{
"template_1" : {
"template" : "foo*",
"settings" : {
"index" : {
@ -6,4 +7,5 @@
"number_of_replicas": 0
}
}
}
}