-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
Extend ecs@mappings to handle type coercion #113124
Comments
I remember this was a conscious decision to omit dynamic templates that map to the default mapping type (if sent properly) in order to minimize the templates and simplify this component, knowing that this puts the burden on shippers to sent the right format, specifically with the port example in mind. I don't know what is the actual overhead of having more dynamic templates, but I think it does make sense to make it less error prone. If we add these, we should probably restrict the
IP fields are already covered.
Not sure what you mean by that. We test both documents with nested values and flattened. Other than that, I can only think of
|
Thanks @eyalkoren , seems like boolean and string/number types is the most important thing to check. It looks like @felixbarny will be back next week, maybe he has some additional input. |
Agreed, IMHO the spirit of |
Pinging @elastic/es-data-management (Team:Data Management) |
First of all, I 100% agree that we need to find a solution for the issues listed in elastic/integrations#10848. But I'm not sure if we should do that by extending We're using Can we instead change integrations that are known to not produce ECS compliant source data? We can either fix the source or add integration-specific mappings. If some integrations aren't yet ready to fully adopt What's obviously not ok is that there's an unknown risk for integrations to adopt The In the long term, I think that the ideal way Elasticsearch should deal with types is that a field can have multiple types at the same time. That way, there's never a situation where we have to reject a document or ignore the field of a document because the type doesn't match. But to do things like range queries, that also relies on the source data actually having the intended type. |
I completely agree with this point, and see my comment that demonstrates such an issue we already have within existing ECS fields. I wanted this PR to show what it's going to look like exactly for this kind of discussion!
|
Thanks both! Should we close this for now and re-open in case some clear improvement emerges that won't have this downside? |
Description
Rolling out
ecs@mappings
to integrations instead of relying on locally defined mappings for ecs fields lead to various issues in production systems, caused by fields being mapped incorrectly due to data arriving in an unexpected format.For example
"destination.port": "1234"
will causedestination.port
to be mapped as a keyword while it is specified as long in ECS.To prevent this kind of problems for integrations as well as users using
ecs@mappings
directly,ecs@mappings
should be extended to cover all ecs fields and specify their type to prevent type coercion errors instead of assuming types are correct in the incoming JSON.To test this, the existing integration tests should be extended with each field receiving data in the wrong format, e.g. if a field is a number type, a string value like
"123"
is tested, if a field is a string type, a number value like123
and1.2
is tested.Open questions
cc @eyalkoren @felixbarny
The text was updated successfully, but these errors were encountered: