I am really new to the elasticsearch world.
Let's say I have nested aggregation in two fields: field1 and field2 :
{ ... aggs: { field1: { terms: { field: 'field1' }, aggs: { field2: { terms: { field: 'field2' } } } } } }
This piece of code works fine and gives me something like this:
aggregations: { field1: { buckets: [{ key: "foo", doc_count: 123456, field2: { buckets: [{ key: "bar", doc_count: 34323 },{ key: "baz", doc_count: 10 },{ key: "foobar", doc_count: 36785 }, ... ] },{ key: "fooOO", doc_count: 423424, field2: { buckets: [{ key: "bar", doc_count: 35 },{ key: "baz", doc_count: 2435453 }, ... ] }, ... ] } }
Now I need to exclude all aggregation results where doc_count less than 1000, and instead:
aggregations: { field1: { buckets: [{ key: "foo", doc_count: 123456, field2: { buckets: [{ key: "bar", doc_count: 34323 },{ key: "foobar", doc_count: 36785 }, ... ] },{ key: "fooOO", doc_count: 423424, field2: { buckets: [{ key: "baz", doc_count: 2435453 }, ... ] }, ... ] } }
Is it possible to establish this need for a request body? or do I need to execute a filter on the caller’s layout (in javascript in my case)?
Thanks in advance
aggregation filtering elasticsearch
M'sieur toph '
source share