Is it possible to get the length of the dataset of its own?

I am using Elasticsearch v.7.10.2 and Vega version is v.4.3.0.

I tried the code below to get the size of the dataset itself and got an error.

"data": [
  {
   "name": "dataset1",
   "values": [{...},{...}],
   "transform":[
    {"type":"formula", "expr":"length(data('dataset1'))", "as":"length"}
    ]
  },

the error message

Cannot read property 'length' of null

Is there any other way to know the length of the dataset itself?

You should be able to use something like hits.total that gets returned from the query to ES itself. Does that work?