-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] nested field type in index template/pattern breaks detector creation #1472
Comments
Hmmmm... interesting. I just found another wrinkle, which I'm going to pull on on my end. I mentioned above that in some of my massaging of the ECS templates one of the things I do is change |
So continuing down that thread I did that: changed my code that was changing the Elasticsearch ECS So I guess I'll leave it up to you, the devs of this project, whether this is something you want to look at anyway or just close and mark it as "invalid." TL;DR: To make Elasticsearch ECS templates compatible with OpenSearch I was changing |
Moving beyond the ECS schema though, for some of my other schemas that still use the |
The more I play with it, the more I do think it's a bug. I'm using |
It seems like it might be an issue when the type is I.e., "details": {
"type": "nested",
"properties": {
"target": { "type": "keyword" },
"size": { "type": "long" },
"used": { "type": "long" },
"avail": { "type": "long" }
}
} seems to be okay, while: "details": { "type": "nested" } is a problem? Maybe that's not a valid use of |
I do think my last comment narrows down on the issue. It seems to me that if the type is I think this is a valid use case, though, as the documentation says that for |
What is the bug?
When attempting to creating a security analytics detector with an index matching an index pattern where the index template has field of type
nested
this error is given:[security_analytics_exception] null cannot be cast to non-null type kotlin.collections.MutableMap<kotlin.String, kotlin.Any>
. The nested field need not be populated in any documents actually stored in the index. Removing thenested
fields from the JSON of my composable index template prior to its creation is a workaround for the error.Error message in console:
How can one reproduce the bug?
I've broken it all down into a self-contained example, which is stored here in a repository where I keep various docker-based projects.
As a little bit of context before I go through these steps, this started with me trying to get security analytics to work with an index template I am using that is based on the Elastic Common Schema. My process involves downloading the ECS sample templates and then doing some massaging of that template prior to its import into OpenSearch (changing some field types, mainly) so that it will import. However, the
nested
field type should be supported, I think, or at the very least it should not cause security analytics to break, as it's defined as a field type within OpenSearch as well.Steps to reproduce the behavior:
nested
field. I did this by downloading the ECS sample templates and then doing some massaging of that template. The one that finally helped me narrow in on this was thedll
template, which has anested
field and also aflattened
field (which I change tonested
prior to import). I'm scripting the creation of the templates after opensearch and dashboards have started up.ecs-*
@timestamp
field totimestamp
(see the video below)[security_analytics_exception] null cannot be cast to non-null type kotlin.collections.MutableMap<kotlin.String, kotlin.Any>
is givenCompare this to a working scenario, where everything is exactly the same, except for one difference: I use
jq
to remove thenested
fields from the template .json files prior to their creation. Everything else is exactly the same, and the detector is created correctly.What is the expected behavior?
The security analytics detector should be created correctly regardless of there being
nested
field mappings defined in the index templateWhat is your host/environment?
Do you have any screenshots?
Screenshot of error:
Video of entire workflow (broken state):
test.mp4
Do you have any additional context?
The text was updated successfully, but these errors were encountered: