Aggregation over big data

Hello,

i would like to ask you for advice.
I have index with milions of documents and need to query it (query will return cca. 100 000 documents) and use results for aggregations.

My current code is:

{
	"query": {
		"terms": {
			"status": ["NEW", "READY"]
		}
	},
	"aggregations": {
		"type": {
			"terms": {
				"field": "type",
				"size": 10000,
			},
			"aggregations": {
				"subtype": {
					"terms": {
						"field": "subtype",
						"size": 100
					},
					"aggregations": {
						"firstDate": {
							"min": {
								"field": "date"
							}
						},
						"lastDate": {
							"max": {
								"field": "date"
							}
						}
					}
				}
			}
		}
	}
}

Problem is, that the aggregations and documentSizes in final buckets are incomplete and thus aggregations incorrect.
I guess the reason is the limit 10 000 documents per query.
I am not owner of the database so I can't change the limit.

Is there any posibility how to get correct results?

Thank you!
Filip

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