Skip to content

Commit d6e03e4

Browse files
committed
adding javadocs
1 parent e3d710e commit d6e03e4

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

server/src/main/java/org/elasticsearch/action/admin/indices/template/post/TransportSimulateIndexTemplateAction.java

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -361,9 +361,20 @@ public static Template resolveTemplate(
361361
);
362362
}
363363

364+
/**
365+
* This method collects the mappings from the given template, pulling them from the given simulatedProject. If the template is a data
366+
* stream template and the given dataStream is not null, this method also appends any mapping overrides from the data stream itself.
367+
* @param simulatedProject Used to fetch the component templates referenced from the template
368+
* @param dataStream Used to fetch any mappings explicitly set on the data stream
369+
* @param template The template matching the index, used to fetch mappings
370+
* @param indexName The name of the index whose templates we are fetching
371+
* @param xContentRegistry Used to parse mappings if necessary
372+
* @return A list of matching mappings in ascending priority order
373+
* @throws IOException
374+
*/
364375
private static List<CompressedXContent> collectMappings(
365376
ProjectMetadata simulatedProject,
366-
DataStream dataStream,
377+
@Nullable DataStream dataStream,
367378
ComposableIndexTemplate template,
368379
String indexName,
369380
NamedXContentRegistry xContentRegistry
@@ -380,7 +391,7 @@ private static List<CompressedXContent> collectMappings(
380391
null, // empty request mapping as the user can't specify any explicit mappings via the simulate api
381392
simulatedProject,
382393
template,
383-
xContentRegistry,
394+
xContentRegistry, // This is never used since requestMappings is always null, but it is not marked explicitly as @Nullable
384395
simulatedIndexName
385396
);
386397
if (template.getDataStreamTemplate() != null && dataStream != null) {
@@ -394,9 +405,18 @@ private static List<CompressedXContent> collectMappings(
394405
return mappings;
395406
}
396407

408+
/**
409+
* This method collects the settings from the given template using the given simulatedProjcet. If dataStream is not null, it also merges
410+
* in any settings overrides on the data stream itself.
411+
* @param simulatedProject The project metadata used to get the settings
412+
* @param dataStream If not null, this is used to get data stream settings overrides
413+
* @param templateName The name of the template
414+
* @param template The template, used to check whether this is a data strema template
415+
* @return The settings to be used
416+
*/
397417
private static Settings collectSettings(
398418
final ProjectMetadata simulatedProject,
399-
final DataStream dataStream,
419+
@Nullable final DataStream dataStream,
400420
String templateName,
401421
ComposableIndexTemplate template
402422
) {

0 commit comments

Comments
 (0)