Skip to content

Commit

Permalink
Fix missing order field in TemplatesMetadata deserialization
Browse files Browse the repository at this point in the history
Signed-off-by: Sooraj Sinha <soosinha@amazon.com>
  • Loading branch information
soosinha committed Aug 29, 2024
1 parent e146f13 commit ed48b59
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,9 @@ public static TemplatesMetadata fromXContent(XContentParser parser) throws IOExc
currentFieldName = parser.currentName();
}
if (currentFieldName != null) {
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
do {
builder.put(IndexTemplateMetadata.Builder.fromXContent(parser, parser.currentName()));
}
} while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT);
}
return builder.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,12 +231,22 @@ public static TemplatesMetadata getTemplatesMetadata() {
return TemplatesMetadata.builder()
.put(
IndexTemplateMetadata.builder("template" + randomAlphaOfLength(3))
.order(1234)
.patterns(Arrays.asList("bar-*", "foo-*"))
.settings(
Settings.builder().put("index.random_index_setting_" + randomAlphaOfLength(3), randomAlphaOfLength(5)).build()
)
.build()
)
.put(
IndexTemplateMetadata.builder("template" + randomAlphaOfLength(3))
.order(5678)
.patterns(Arrays.asList("test-*"))
.settings(
Settings.builder().put("index.random_index_setting_" + randomAlphaOfLength(3), randomAlphaOfLength(5)).build()
)
.build()
)
.build();
}
}

0 comments on commit ed48b59

Please sign in to comment.