Reverting back to 0.90.7 config/templates loading behaviour
Closes #4511
This commit is contained in:
parent
bbffeb1b39
commit
0bef2c66a9
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
{
|
{
|
||||||
|
"template_1" : {
|
||||||
"template" : "foo*",
|
"template" : "foo*",
|
||||||
"settings" : {
|
"settings" : {
|
||||||
"index.number_of_shards": 10,
|
"index.number_of_shards": 10,
|
||||||
"index.number_of_replicas": 0
|
"index.number_of_replicas": 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
|
@ -1,7 +1,9 @@
|
||||||
{
|
{
|
||||||
|
"template_1" : {
|
||||||
"template" : "foo*",
|
"template" : "foo*",
|
||||||
"settings" : {
|
"settings" : {
|
||||||
"number_of_shards": 10,
|
"number_of_shards": 10,
|
||||||
"number_of_replicas": 0
|
"number_of_replicas": 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
|
@ -1,4 +1,5 @@
|
||||||
{
|
{
|
||||||
|
"template_1" : {
|
||||||
"template" : "foo*",
|
"template" : "foo*",
|
||||||
"settings" : {
|
"settings" : {
|
||||||
"index" : {
|
"index" : {
|
||||||
|
@ -7,3 +8,4 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue