Children aggregation not returning results

Using a mapping with:

"stats_rel": {
        "type": "join",
        "relations": {
          "metadata": "stat"
        }
      }```

and sample data of:

```{
				"_index": "irustest",
				"_type": "_doc",
				"_id": "14000018",
				"_score": 1.0,
				"_source": {
					"source_item_type": "journal-article",
					"core_id": 275196082,
					"doi": "10.1016/0040-9383(70)90057-1",
					"yop": "2002",
					"title": "A vanishing theorem for the unstable Adams spectral sequence",
					"publisher": "Elsevier BV",
					"item_id": 14000018,
					"repository_name": "CORE",
					"core_repository_id": 4786,
					"service_id": 3,
					"creator": "A.K. Bousfield",
					"institution_name": "CORE",
					"irus_type": "{Unspecified}",
					"join": {
						"name": "metadata"
					}
				}
			},
			{
				"_index": "irustest",
				"_type": "_doc",
				"_id": "gNXTZHkB2yKCvkdh4bmd",
				"_score": 1.0,
				"_routing": "14000018",
				"_source": {
					"country_code": "SG",
					"yyyymm": "2021-01-01",
					"total_item_requests": 0,
					"unique_item_requests": 0,
					"customer_id": 0,
					"continent_code": "AS",
					"access_method_id": 1,
					"total_item_investigations": 0,
					"unique_item_investigations": 1,
					"lat": "1.352083",
					"long": "103.819836",
					"join": {
						"name": "stat",
						"parent": "14000018"
					}
				}
			}```

The query:
```{
     "size": 5,
    "query": {
        "match": { "title": "theorem"}
    },
    "aggs": {
    "to-stats": {
        "children": {
            "type" : "stat" 
        },
        "aggs": {
            "total_unq": {
                "sum": {
                    "field": "unique_item_investigations"
                }
            }
        }
    }
}
}```

does not produce any values for the aggregation:
```{
    "took": 2,
    "timed_out": false,
    "_shards": {
        "total": 5,
        "successful": 5,
        "skipped": 0,
        "failed": 0
    },
    "hits": {
        "total": {
            "value": 1,
            "relation": "eq"
        },
        "max_score": 3.807752,
        "hits": [
            {
                "_index": "irustest",
                "_type": "_doc",
                "_id": "14000018",
                "_score": 3.807752,
                "_source": {
                    "source_item_type": "journal-article",
                    "core_id": 275196082,
                    "doi": "10.1016/0040-9383(70)90057-1",
                    "yop": "2002",
                    "title": "A vanishing theorem for the unstable Adams spectral sequence",
                    "publisher": "Elsevier BV",
                    "item_id": 14000018,
                    "repository_name": "CORE",
                    "core_repository_id": 4786,
                    "service_id": 3,
                    "creator": "A.K. Bousfield",
                    "institution_name": "CORE",
                    "irus_type": "{Unspecified}",
                    "join": {
                        "name": "metadata"
                    }
                }
            }
        ]
    },
    "aggregations": {
        "to-stats": {
            "doc_count": 0,
            "total_unq": {
                "value": 0.0
            }
        }
    }
}```
I was expecting one document in the aggregation

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