Reputation: 5611
I have a nested type mapping in my index:
"actors": {
"type": "nested",
"properties": {
"actor": {
"type": "nested",
"properties": {
"actor_full_name": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
}
}
}
}
When i see the datas it looks to be ok
The request
GET /test_index/film/_search
{
"size": 100,
"_source": "actors.actor.actor_full_name"
}
Give me this answer:
"actors": {
"actor": [
{
"actor_full_name": "Antonio BANDERAS"
},
{
"actor_full_name": "Diane VENORA"
},
{
"actor_full_name": "Omar SHARIF"
},
{
"actor_full_name": "Vladimir KULICH"
}
]
},
...
I am trying to do a nested aggregation request on actor_full_name field
I am trying this request:
POST /test_index/film/_search
{
"size": 0,
"aggs": {
"actor_nested_agg_code": {
"nested": {
"path": "actors"
},
"aggs": {
"code_actor_agg": {
"terms": {
"field": "actor.actor_full_name.keyword",
"size": 100
}
}
}
}
}
}
Unfortunately it appears to give me an incorect aswere :
"aggregations": {
"actor_nested_agg_code": {
"doc_count": 1807,
"code_actor_agg": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": []
}
}
}
Do you see what i did wrong and how i could fix it please?
Upvotes: 0
Views: 37
Reputation: 52366
You either didn't mean to make actors
nested as well, or you overlooked that you have two nested
fields in there:
{
"size": 0,
"aggs": {
"actor_nested_agg_code": {
"nested": {
"path": "actors"
},
"aggs": {
"second_nested_actor": {
"nested": {
"path": "actors.actor"
},
"aggs": {
"code_actor_agg": {
"terms": {
"field": "actors.actor.actor_full_name.keyword",
"size": 100
}
}
}
}
}
}
}
}
Upvotes: 1