aggregate - ElasticSearch: scoped aggregation -
my understanding can apply aggs scope of query. if run query only, brings 21k hits. however, when add aggs it, comes empty. doing wrong?
thank you,
{ "query": { "bool": { "must": [ { "term": {"app.raw": "me"} } ,{ "term": {"cat.raw": "iv"} } ,{ "term": {"sub.raw": "act"} } ] } } , "aggs": { "distinct_users": { "cardinality": { "field": "login", "precision_threshold": 1000 } } } }
because request elasticsearch has "aggs" parameter, "size" parameter defaults 0 , query results not returned, aggregation results.
add "size" field whatever value want topmost object in query return search hits, e.g.
{ query: { ... }, size: 42, aggs: { ... } }
Comments
Post a Comment