Average number of documents per buckets

Suppose I have a mapping

{
    "properties": {
        "jobName": {
            "type": "keyword"
        },
      "jobNumber": {
            "type": "long"
        },
      ...
}

What I am trying to do is to get metrics of the average number of document for each jobName.

If there are 2000 entries for jobName: foo and jobNumber: 123, and 1000 entries for jobName: foo and jobNumber: 456, then it should produce 1500 for jobName: foo. It will do the same for jobName: bar, jobName: baz, etc.

I've been playing with metrics visualization to achieve this but can't figure out how to do so, let alone not sure if this is the right visualization tool.

Appreciate your help.

It sounds like you can do this with the metric visualization and the "avg bucket" aggregation (host.keyword would be jobNumber in your case):

If you want to do this per jobName, you can add a bucket terms aggregation on jobName

This will give you the average count of entries per jobNumber per jobName

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