Nested object aggs query

Hi, I have one index which has document as follows:
{
"_index": "issue_index_v1",
"_type": "issue",
"_id": "830275",
"_score": null,
"_source": {
"id": 830275,
"projectCustom2159": {
"customField832": 3
}
},
"sort": [
"3"
]
},
...
{
"_index": "issue_index_v1",
"_type": "issue",
"_id": "830058",
"_score": null,
"_source": {
"id": 830058,
"projectCustom2159": {
"customField832": 4
}
},
"sort": [
"4"
]
},
{
"_index": "issue_index_v1",
"_type": "issue",
"_id": "830072",
"_score": null,
"_source": {
"id": 830072,
"projectCustom2159": {
"customField832": 4
}
},
"sort": [
"4"
]
},
{
"_index": "issue_index_v1",
"_type": "issue",
"_id": "830170",
"_score": null,
"_source": {
"id": 830170,
"projectCustom2159": {
"customField832": 4
}
},
"sort": [
"4"
]
},
{
"_index": "issue_index_v1",
"_type": "issue",
"_id": "830266",
"_score": null,
"_source": {
"id": 830266,
"projectCustom2159": {
"customField832": 4
}
},
"sort": [
"4"
]
},
{
"_index": "issue_index_v1",
"_type": "issue",
"_id": "830104",
"_score": null,
"_source": {
"id": 830104,
"projectCustom2159": {
"customField832": 4
}
},
"sort": [
"4"
]
},
{
"_index": "issue_index_v1",
"_type": "issue",
"_id": "830987",
"_score": null,
"_source": {
"id": 830987,
"projectCustom2159": {
"customField832": 5
}
},
"sort": [
"5"
]
},
{
"_index": "issue_index_v1",
"_type": "issue",
"_id": "830990",
"_score": null,
"_source": {
"id": 830990,
"projectCustom2159": {
"customField832": 5
}
},
"sort": [
"5"
]
},
{
"_index": "issue_index_v1",
"_type": "issue",
"_id": "831022",
"_score": null,
"_source": {
"id": 831022,
"projectCustom2159": {
"customField832": 5
}
},
"sort": [
"5"
]
},
{
"_index": "issue_index_v1",
"_type": "issue",
"_id": "830985",
"_score": null,
"_source": {
"id": 830985,
"projectCustom2159": {
"customField832": 5
}
},
"sort": [
"5"
]
},
{
"_index": "issue_index_v1",
"_type": "issue",
"_id": "830518",
"_score": null,
"_source": {
"id": 830518
},
"sort": [
null
]
},
{
"_index": "issue_index_v1",
"_type": "issue",
"_id": "830329",
"_score": null,
"_source": {
"id": 830329
},
"sort": [
null
]
}

Now I wan't to query value count aggs on projectCustom2159.customField832, I wrote the query as follows:
{"aggs":{"projectCustom2159":{"aggs":{"customField832":{"aggs":{"1":{"aggs":{"2":{"value_count":{"field":"id"}}},"reverse_nested":{}}},"terms":{"field":"projectCustom2159.customField832","size":10000,"order":{"_term":"asc"},"missing":"-2147483648"}}},"nested":{"path":"projectCustom2159"}}},"sort":{"projectCustom2159.customField832":{"order":"asc","mode":"max","nested_path":"projectCustom2159"}},"_source":{"includes":[],"excludes":["description"]},"from":0,"query":{"bool":{"filter":[]}},"size":10000}

the result shows:
"aggregations": {
"projectCustom2159": {
"doc_count": 16,
"customField832": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"1": {
"2": {
"value": 4
},
"doc_count": 4
},
"key": "3",
"doc_count": 4
},
....
}
}
}

Indeed, I want

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