Skip to content

[BUG] timechart returns empty buckets #4632

Closed

Description

@yuancu

Query Information

PPL Command/Query:

source=events | timechart span=1m count() by host

Expected Result:

{
  "schema": [
    {
      "name": "@timestamp",
      "type": "timestamp"
    },
    {
      "name": "host",
      "type": "string"
    },
    {
      "name": "count()",
      "type": "bigint"
    }
  ],
  "datarows": [
    [
      "2023-01-01 10:25:00",
      "server2",
      1
    ],
    [
      "2023-01-01 10:35:00",
      "server2",
      1
    ],
    [
      "2023-01-01 10:20:00",
      "server1",
      1
    ],
    [
      "2023-01-01 10:10:00",
      "server1",
      1
    ],
    [
      "2023-01-01 10:15:00",
      "server2",
      1
    ],
    [
      "2023-01-01 10:30:00",
      "server1",
      1
    ],
    [
      "2023-01-01 10:05:00",
      "server2",
      1
    ],
    [
      "2023-01-01 10:00:00",
      "server1",
      1
    ]
  ],
  "total": 8,
  "size": 8
}

Actual Result:

{
  "schema": [
    {
      "name": "@timestamp",
      "type": "timestamp"
    },
    {
      "name": "host",
      "type": "string"
    },
    {
      "name": "count",
      "type": "bigint"
    }
  ],
  "datarows": [
    [
      "2023-01-01 10:00:00",
      "server1",
      1
    ],
    [
      "2023-01-01 10:00:00",
      "server2",
      0
    ],
    [
      "2023-01-01 10:05:00",
      "server1",
      0
    ],
    [
      "2023-01-01 10:05:00",
      "server2",
      1
    ],
    [
      "2023-01-01 10:10:00",
      "server1",
      1
    ],
    [
      "2023-01-01 10:10:00",
      "server2",
      0
    ],
    [
      "2023-01-01 10:15:00",
      "server1",
      0
    ],
    [
      "2023-01-01 10:15:00",
      "server2",
      1
    ],
    [
      "2023-01-01 10:20:00",
      "server1",
      1
    ],
    [
      "2023-01-01 10:20:00",
      "server2",
      0
    ],
    [
      "2023-01-01 10:25:00",
      "server1",
      0
    ],
    [
      "2023-01-01 10:25:00",
      "server2",
      1
    ],
    [
      "2023-01-01 10:30:00",
      "server1",
      1
    ],
    [
      "2023-01-01 10:30:00",
      "server2",
      0
    ],
    [
      "2023-01-01 10:35:00",
      "server1",
      0
    ],
    [
      "2023-01-01 10:35:00",
      "server2",
      1
    ]
  ],
  "total": 16,
  "size": 16
}

Empty buckets are returned. However, according to documents:

Only combinations with actual data are included in the results - empty combinations are omitted rather than showing null or zero values.

However, for other aggregations like max, it does not return empty buckets:

source=events | timechart span=1min max(packets) by host
{
  "schema": [
    {
      "name": "@timestamp",
      "type": "timestamp"
    },
    {
      "name": "host",
      "type": "string"
    },
    {
      "name": "max(packets)",
      "type": "bigint"
    }
  ],
  "datarows": [
    [
      "2023-01-01 10:00:00",
      "server1",
      60
    ],
    [
      "2023-01-01 10:05:00",
      "server2",
      30
    ],
    [
      "2023-01-01 10:10:00",
      "server1",
      60
    ],
    [
      "2023-01-01 10:15:00",
      "server2",
      30
    ],
    [
      "2023-01-01 10:20:00",
      "server1",
      60
    ],
    [
      "2023-01-01 10:25:00",
      "server2",
      30
    ],
    [
      "2023-01-01 10:30:00",
      "server1",
      180
    ],
    [
      "2023-01-01 10:35:00",
      "server2",
      90
    ]
  ],
  "total": 8,
  "size": 8
}

Dataset Information

Dataset/Schema Type

  • Custom (details below)

Index Mapping

{
  "mappings": {
    "properties": {
      "@timestamp": {
        "type": "date"
      },
      "host": {
        "type": "text"
      },
      "cpu_usage": {
        "type": "double"
      },
      "region": {
        "type": "keyword"
      }
    }
  }
}

Sample Data

{"@timestamp":"2023-01-01T10:00:00Z","event_time":"2023-01-01T09:55:00Z","host":"server1","message":"Starting up","level":"INFO","category":"orders","status":"pending","packets":60}

Impact:
Users get confused on what to expect from results.

Activity

  1. added
    bug
    PPL
    on Oct 22, 2025
  2. self-assigned this
    on Oct 22, 2025
  3. moved this from Not Started to In progress in PPL Trackeron Oct 27, 2025
  4. yuancu commented on Oct 29, 2025

    @yuancu
    CollaboratorAuthor

    Will fix by merging the implementation of timechart and chart

  5. moved this from In progress to In review in PPL Trackeron Nov 10, 2025
  6. moved this from In review to Done in PPL Trackeron Nov 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

PPLbug

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions