elasticsearch - Count distinct id where field exists -



elasticsearch - Count distinct id where field exists -

i trying create in elasticsearch query lists distinct user_label.id each respectiv counts:

sample document looks likes this:

{ "_index": "labels", "_type": "users", "_id": "484", "_version": 69, "found": true, "_source": { "id": 484, "is_complete": 1, "language": "nl", "user_label": [ { "guid": { "163579": { "order_id": 163579 } }, "id": "boleto" } ] } }

mapping type nested.

"user_label" : { "type" : "nested", "properties" : { "guid" : {}, "id" : { "type" : "string" }, "tag" : { "type" : "string" } } }

i want build table like:

+---------------+-------+ | boleto | 32453 | | paid | 34345 | | reminder_sent | 345 | +---------------+-------+

i have far language, need help creating user_label.id:

{ "size": 0, "aggs": { "genders": { "terms": { "field": "language" } } } }

have tried using "field":"user_label.id" didn't worked. tried type properties , there dot notation works, doesn't seam work type nested

so after digging outcome:

{ "size": 0, "aggs": { "user_label": { "nested": { "path": "user_label" }, "aggs": { "id": { "terms": { "field": "user_label.id" } } } } } }

elasticsearch

Comments

Popular posts from this blog

java Multi query from Mysql using netbeans -

c# - DotNetZip fails with "stream does not support seek operations" -

c++ - StartServiceCtrlDispatcher don't can access 1063 error -