Skip to content

[o365] Field file.size being mapped as keyword leading to mapping conflict and rules failing #21137

Closed

Description

@leandrojmp

Hello,

On the o365.audit dataset the field file.size is now being wrongly mapped as a keyword field, this field is populated from one of those fields in the ingest pipeline:

  - set:
      tag: set_file_size_723563fe
      field: file.size
      copy_from: o365audit.FileSizeBytes
      ignore_empty_value: true
  - set:
      tag: set_file_size_c6196fe8
      field: file.size
      copy_from: o365audit.FileSize
      ignore_empty_value: true
      override: false

Since there is no explicit mapping for file.size, it will be dynamically mapped depending on the value from the field.

Somewhere between May and June the field o365audit.FileSizeBytes started arriving as a keyword instead as a long, which lead to a mapping conflict in kibana on all backing indices created after that change, which can break dashboards and security rules.

On an event from May I have this:

Image

But on an event on June I have this:

Image

So it changed from a long to a keyword, since I have a backing index with file.size mapped as long, this leads to mapping conflicts and break security rules, one example of a rule breaking is the native rule: M365 OneDrive/SharePoint Excessive File Downloads

This can be fixed with a convert processor to convert the file.size or using a explicit mapping for it.

Activity

  1. infra-vault-gh-plugin-prod commented on Sep 8, 2026

    @infra-vault-gh-plugin-prod

    Pinging @elastic/security-service-integrations (Team:Security-Service Integrations)

  2. changed the title [-][M365] Field file.size being mapped as keyword leading to mapping conflict and rules failing[/-] [+][o365] Field file.size being mapped as keyword leading to mapping conflict and rules failing[/+] on Sep 8, 2026
  3. efd6 commented on Sep 8, 2026

    @efd6
    Contributor

    This was caused by #19245. Since file.size is an ECS-defined field, with type long, dynamically mapping it to a keyword is a bug, so this should be fixed. It would be a breaking change since users who have ingested data since #19245 will have the field mapped as a keyword (and so see the same issue that you are seeing, but from the other direction).

    I've just gone through my notes; I have one that specifically refers to #19245 and this behaviour from 2026-06-24. This is the final conclusion in that note:

    For non-ECS fields: these are a moving target and not reasonable to track through type changes. No action.

    For file.size: a regression for an ECS field, but restoring the converter would be more type churn. The root issue is partially a Microsoft API bug (sending byte counts in scientific notation). Not planning to fix; will discuss with the CA.

    The change should have been labelled as a breaking change in the changelog. Any further fix would itself be another breaking change, so the practical path is to leave it and let affected customers settle on the new behaviour.

    The assessment of the change:

    The change should have been marked as a breaking change in the changelog because it alters the type of values arriving at Elasticsearch for established fields, with observable mapping consequences.

  4. added
    bugSomething isn't working, use only for issues
    on Sep 8, 2026
  5. chrisberkhout commented on Sep 9, 2026

    @chrisberkhout
    Contributor

    #19245 letting a string value come out of the pipeline for file.size would not be a problem if the file.size field was mapped to its ECS type.

    I previously assumed the ECS dynamic mappings shipped with Elasticsearch would map ECS fields correctly, but the only do that for some ECS fields.

    The easiest way for #19245 to have avoided the problem, or to fix it now, is to add an explicit ECS mapping for file.size.

    Perhaps the type change in the _source document could be considered breaking, but I don't think we have clear rules about that.

  6. leandrojmp commented on Sep 9, 2026

    @leandrojmp
    ContributorAuthor

    hello @chrisberkhout

    There is an old issue to discuss how to deal with those kind of breaking changes and make it clear for the users, it is this one: #13861

    But it seems to be stalled.

    A mapping type change may always introduce a breaking change in Security Rules and Visualizations/Dashboards and the workaround to fix this (reindex, remove the data, runtime field) may not be possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Integration:o365Microsoft Office 365Team:Security-Service IntegrationsSecurity Service Integrations team [elastic/security-service-integrations]bugSomething isn't working, use only for issues

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions