Skip to content

Commit

Permalink
Reverting back to 0.90.7 config/templates loading behaviour
Browse files Browse the repository at this point in the history
Closes #4511
  • Loading branch information
spinscale committed Dec 20, 2013
1 parent 1d96574 commit 060895f
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 16 deletions.
Expand Up @@ -484,7 +484,7 @@ private List<IndexTemplateMetaData> findTemplates(Request request, ClusterState
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);
}
Expand Down
Expand Up @@ -58,7 +58,7 @@ protected Settings nodeSettings(int nodeOrdinal) {

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);
Expand Down
12 changes: 7 additions & 5 deletions src/test/java/org/elasticsearch/indices/template/template0.json
@@ -1,7 +1,9 @@
{
"template" : "foo*",
"settings" : {
"index.number_of_shards": 10,
"index.number_of_replicas": 0
}
"template_1" : {
"template" : "foo*",
"settings" : {
"index.number_of_shards": 10,
"index.number_of_replicas": 0
}
}
}
10 changes: 6 additions & 4 deletions src/test/java/org/elasticsearch/indices/template/template1.json
@@ -1,7 +1,9 @@
{
"template" : "foo*",
"settings" : {
"number_of_shards": 10,
"number_of_replicas": 0
"template_1" : {
"template" : "foo*",
"settings" : {
"number_of_shards": 10,
"number_of_replicas": 0
}
}
}
12 changes: 7 additions & 5 deletions src/test/java/org/elasticsearch/indices/template/template2.json
@@ -1,9 +1,11 @@
{
"template" : "foo*",
"settings" : {
"index" : {
"number_of_shards": 10,
"number_of_replicas": 0
"template_1" : {
"template" : "foo*",
"settings" : {
"index" : {
"number_of_shards": 10,
"number_of_replicas": 0
}
}
}
}

0 comments on commit 060895f

Please sign in to comment.