Vertical Bar Unique Count all counts = 1

I'm trying to visualize dns log data in a vertical chart. X-axis should be remote_host. Y-axis should be count of remote_host.

I do this by setting Data -> Metrics -> Y-axis -> Aggregation to Unique Count and Field to remote_host. Then, I set Buckets -> X-axis -> Aggregation to Terms and Field to remote_host.

It produces a histogram but all the counts are always equal to 1. I've confirmed that the counts should not all equal one with this query:

{
  "_source": ["@timestamp", "client_ip", "remote_host"],
  "size": 0,
  "sort": [
    { "@timestamp" : {"order" : "asc"}}
  ],
  "aggs": {
    "remote_hosts": {
      "terms": {
        "field": "remote_host",
        "size": 10000
      }
    }
  },
  "query": {
    "bool": {
      "must": [
        {"wildcard" : { "client_ip" : "#{@client_ip}" }},
        {
          "range": {
            "@timestamp": {
              "gte": "#{@start_date}",
              "lte": "#{@end_date}"
            }
          }
        }
      ]
    }
  }
}

@start_date, @end_date, etc are ruby variables that are replaced with values before the query is sent to elastic.

I'm not familiar with the Vertical bar visualization, but will note the Lens visualization might be able to provide this - and let you easily explore other visualizations of that data - see Dashboard | Kibana Guide [7.11] | Elastic

Also a little curious about the ruby variables. Are you scripting the building of the visualizations? I'm wondering if the interpolation of the ruby variables by your process might somehow be messing something up.