This API is actually unused and it probably should be removed. You should use POST /_plugins/_security_analytics/mappingsto apply mappings. It supports datastreams.
Yes, mapping APIs support data streams and index patterns. However, the endpoint you are using to create mappings, /_plugins/_security_analytics/mappings, is specific to the OpenSearch Security Analytics plugin and may not work with data streams. Additionally, you should use the POST method instead of PUT.
Here’s an example of how you can create a mapping using the correct endpoint and method:
“source-ip” is not mapped Sigma field hence you don’t get any applied aliases.
This is expected workflow using APIs:
Call GET /_plugins/_security_analytics/mappings/view to get automatically mapped fields(returned in properties field) and unmapped sigma fields(returned in unmapped_field_aliases field).
You will get unmapped Sigma fields from ALL rules of rule category you selected(for example windows). If you don’t want to select ALL rules in detector, you can fetch all rule fields for rules that you want enabled. Here is query example for fetching Sigma field names for 1 rule of network category with id 286b47ed-f6fe-40b3-b3a8-35129acd43bc:
Thanks for the clarification.
So maybe I just don’t have to right approach for what I try to achieve…
I try to create Sigma rules for index patterns having custom nested fields (dns.response.code, source.ip …)
I try to create a new mapping because:
I want to map my custom fields
dot notation is not supported
Here is a rule I try to create
selection:
dns.response_code:
- NXDOMAIN
- SERVFAIL
condition: selection | count(dns.question.name) by source.ip > 10
timeframe: 2m