Create a Boxplot with Elastic Index

I'm trying to use Vega to create a boxplot with my elastic index data. My Vega code is here.

{
  "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
  "height": 400,
  "width": 100
  "title": "Bootstrapped Model Metric Comparisons",
  data: {
    name: boxplot_data
    url: {
      %context%: true
      index: boxplot_data_new
      body: {
        size: 100
        _source: ["Model", "Category", "Metric_Val"]
      }
    }
    # We only need the content of hits.hits array
    format: {property: "hits.hits"}
    "transform":[
    {
      "type":"formula",
      "expr":"datum._source.Category",
      "as":"category"
    },
    {
      "type":"formula",
      "expr":"datum._source.Metric_Val+0",
      "as":"metric_value"
    }
  ]
  }
  
 "mark": {
  "type": "boxplot",
  "extent": 1.5
  }
    
  "encoding": {
    "column": {
      "field": "_source.Category",
      "type": "nominal",
      "title": "Category"},
    "y": {
      "field": "_source.Metric_Val",
      "type": "quantitative",
      "title": "Metric"
    },
    "x": {
      "field": "_source.Model",
      "type": "nominal",
      "title": false,
      "axis": {"labels": false}
    },
    "color": {
      "field": "_source.Model",
      "type": "nominal",
      "title": ""
    }
  }
}

My elastic index data looks like this.

{
  "took": 1,
  "timed_out": false,
  "_shards": {
    "total": 1,
    "successful": 1,
    "skipped": 0,
    "failed": 0
  },
  "hits": {
    "total": 30,
    "max_score": 1,
    "hits": [
      {
        "_index": "boxplot_data_new",
        "_id": "kYbYyJEB_-YoQLLCVWnv",
        "_score": 1,
        "_source": {
          "Model": "Model 1",
          "Category": "Category 1",
          "Metric_Val": 0
        }
      },
      {
        "_index": "boxplot_data_new",
        "_id": "kobYyJEB_-YoQLLCVWnw",
        "_score": 1,
        "_source": {
          "Model": "Model 1",
          "Category": "Category 1",
          "Metric_Val": 0.25
        }
      },

But I'm getting the two errors shown below:

Any help is appreciated!

Hi @brettmwerner,

Welcome! The Infinite extent for field <field> error is normally an indication that the field can't be resolved or found. Can you check and share the output of the Vega datasets screen under the debug tab?

Having a rough guess without seeing the Vega dataset, I would assume that _source is not needed in your encoding mappings since you've set the format property in your data field. But I am going off of these examples which are slightly different.

Thanks I got this fixed by adding the "scale": {"domain": [0,1]} to my "y" encoding. And I suppressed the "Maximum optimization runs(5) reached error" suppressed by adding "config":{
"kibana": {"hideWarnings": true}
}.

Thanks for your reply!