Metric aggregation fails in composite aggregation

Hi!

I'm using Elasticsearch to store test results of a software. I'm running Elasticsearch on Docker CE with the following configuration:

Docker version 17.12.0-ce, build c97c6d6
Ubuntu 14.04.5 LTS 14.04 trusty
docker.elastic.co/elasticsearch/elasticsearch-oss:6.2.1
docker.elastic.co/kibana/kibana-oss:6.2.1

The documents look like the following:

{  
   "product":{  
      "software":{  
         "revision":"251ebc1ed721622f49c5485068f8b39c45005a20",
         "date":"2018-02-09T17:40:34+00:00"
      },
      "os":{  
         "name":"Ubuntu",
         "version":"14.04"
      }
   },
   "results":{  
      "summary":{  
         "Pass":2,
         "Fail":3
      }
   }
}

I want to compute the average Pass and Fail numbers for all combinations of os.name and os.version for their newest software version, so I use the following Composite query:

GET _search
{
  "size": 0,
    "query": {
      "match_all": {}
    },
    "aggs": {
      "products": {
        "composite": {
          "sources": [
            {
              "osName": {
                "terms": {
                  "field": "product.os.name.keyword"
                }
              }
            },
            {
              "osVer": {
                "terms": {
                  "field": "product.os.version.keyword"
                }
              }
            }
          ]
        },
        "aggs": {
          "revision": {
            "terms": {
              "field": "product.software.revision.keyword",
              "order": {
                "SWDate": "desc"
              },
              "size": 1
            },
            "aggs": {
              "SWDate": {
                "max": {
                  "field": "product.software.date"
                }
              },
               "Pass": {
                "avg": {
                  "field": "results.summary.Pass",
                  "missing": 0
                }
              }
            }
          }
        }
      }
    }
  }

However, this fails with:

"_shards": {
    "total": 6,
    "successful": 1,
    "skipped": 0,
    "failed": 5,
    "failures": [
      {
        "shard": 0,
        "index": "test_results",
        "node": "<nodeId>",
        "reason": {
          "type": "illegal_state_exception",
          "reason": "Cannot replay yet, collection is not finished: postCollect() has not been called"
        }
      }
    ]
  }

If I remove the Pass average aggregation it does not fail but id does fail with other metric aggregations. Any ideas what I might do wrong? Thanks!

It seems that when running elasticsearch 6.1.1 it d seems to work intermittently whereas in 6.2.1 it is fully reproducible.

Created https://github.com/elastic/elasticsearch/issues/28688 for this as I believe it is a bug.

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