Skip to content

Commit fd67c65

Browse files
Code cleanup
1 parent 6329493 commit fd67c65

File tree

4 files changed

+274
-278
lines changed

4 files changed

+274
-278
lines changed

detection_rules/misc.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,3 +489,16 @@ def _wrapped(*args: Any, **kwargs: Any) -> Any: # noqa: PLR0912
489489
return _wrapped
490490

491491
return _wrapper
492+
493+
494+
def get_simulated_index_template_mappings(elastic_client: Elasticsearch, name: str) -> dict[str, Any]:
495+
"""
496+
Return the mappings from the index configuration that would be applied
497+
to the specified index from an existing index template
498+
499+
https://elasticsearch-py.readthedocs.io/en/stable/api/indices.html#elasticsearch.client.IndicesClient.simulate_index_template
500+
"""
501+
template = elastic_client.indices.simulate_index_template(name=name)
502+
if not template:
503+
return {}
504+
return template["template"]["mappings"]["properties"]

0 commit comments

Comments
 (0)