How to resolve "Infinite extent for field" if the field is not in all ingested documents?

I have a field named runtime, however, it does not present in all ingested document within the index pattern. Is there a way to filter out the document that does not contains the runtime field for Vega to work?

{
  $schema: https://vega.github.io/schema/vega-lite/v5.json
  mark: circle

  data: {
    url: {
      %context%: true
      %timefield%: timestamp

      index: prod-*
      body: {
        size: 10000
        _source: ["timestamp", "simulator", "runtime"]
      }
    }
    
    "transform": [
      {
        "type": "filter",
        "expr": "datum['simulator'] != null && datum['runtime'] != null"
      }
    ]

    format: { property: "hits.hits" }
  }

  encoding: {
    x: {
      field: _source.simulator
      type: ordinal
      axis: { title: "Simulator" }
    }
    y: {
      field: _source.runtime
      type: quantitative
      axis: { title: "Runtime" }
    }
    color: {
      field: _source.simulator
      type: nominal
      legend: { title: "Simulator" }
    }
  }
}

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.