On my Elasticsearch server, I have three indexes: Person , Archive and Document .
Each document has an Archive field, which is the _id Archive in which it is located.
Each archive has an owner , which is an _id Person , which is the owner of the archive.
With the above indexes, I can aggregate documents into buckets of archives and archives into buckets of owners.
How can I also include documents in the aggregation of individuals, so if I filter for a specific person, I get archives and their documents that belong to a person, and not just archives?
This is what I have so far filtered and collated archives into buckets of owners:
{ "post_filter": { "terms": { "owner": [ "my_owner_id" ] } }, "aggs": { "_filter_archive": { "filter": { "terms": { "owner": [ "my_owner_id" ] } }, "aggs": { "archive": { "terms": { "field": "archive" } } } } } }
search elasticsearch faceted-search
Oskar persson
source share