How to query by size/length of nested property

Assume the following mapping - A user has a nested array of "posts" objects:

PUT users
{
	"settings": {
		...
	},
	"mappings": {
		"user": {
			"dynamic": false,
			"_all": {"enabled": false },
			"properties": {
				"gender": {
					"type": "string",
					"index": "not_analyzed"
				},
				"posts": {
					"type": "nested",
					"properties": {
						"post_date": {
							"type": "date",
							"format": "epoch_second"
						},
						"text": {
							"type": "string",
							"analyzer": "not_analyzed"
						},
					}
				}
			}
		}
	}
}

I want to search for users that have more than 1 post (or other variations based on the length/size of the posts field) How do I write this search in Elasticsearch 5.x? I've tried every combination I've found online (searches, filters, script queries, etc) and I can't find anything that works.

Thanks in advance.
BP

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