In my ES I've a schema type like this:
{
"index_v1":{
"mappings":{
"fuas":{
"properties":{
"comment":{
"type":"string"
},
"matter":{
"type":"string"
},
"metainfos":{
"properties":{
"department":{
"type":"string"
},
"processos":{
"type":"string"
}
}
}
}
}
}
}
}
Shortly, fuas
type has two properties comment
and matter
and an inner (not nested) object metainfos
with several properties department
and processos
.
I'd like to know how many metainfos' fields
are informed with its number of occurrences.
Imagine a document doc1
with metainfos: {department: "d1"}
and a doc2
with metainfos: {department: "d2", processos: "p1"}
.
Then I'd like to get: { department: 2, processos: 1}
.
Any ideas?