elasticsearch - Elastic search aggregation sum -
im using elasticsearch 1.0.2 , want perform search on using query aggregation functions sum()
suppose single record info that
{ "_index": "outboxpro", "_type": "message", "_id": "payeom_mrgytixrucdn0-w", "_score": 4.5409594, "_source": { "team_id": "1bf5f3f968e36336c9164290171211f3", "created_user": "1a9d05586a8dc3f29b4c8147997391f9", "created_ip": "192.168.2.245", "folder": 1, "report": [ { "networks": "ec466c09fd62993ade48c6c4bb8d2da7facebook", "status": 2, "info": "ok" }, { "networks": "bdc33d8ca941b8f00c2a4e046ba44761twitter", "status": 2, "info": "ok" }, { "networks": "ad2672a2361d10eacf8a05bd1b10d4d8linkedin", "status": 5, "info": "[unauthorized] invalid or expired token." } ] } } let's need fetch count of success messages posted status = 2 in report field. there many record in collection. want take study of success messages posted.
i have tried next code ////////////// edit
{ "size": 2000, "query": { "filtered": { "query": { "match": { "team_id": { "query": "1bf5f3f968e36336c9164290171211f3" } } } } }, "aggs": { "genders": { "terms": { "field": "report.status" } } } } please help me find solution. newbie in elastic search. there other aggregation method find 1 ?. help much appreciate.
your script filter slow on big info , doesn't utilize benefits of "indexing". did think parent/child instead of nested? if utilize parent/child - utilize aggregations natively , utilize calculate sum.
elasticsearch nosql
No comments:
Post a Comment