I have an Elasticsearch query with nested aggregations. It was working as expected but when I added a function_score
query it seems to not take it into account.
This is my query:
GET reviews/_search
{
"size": 0,
"aggs": {
"media": {
"filter": {
"term": {
"profileId": "uuid"
}
},
"aggs": {
"items": {
"filter": {
"exists": {
"field": "gallery"
}
},
"aggs": {
"top_reviews_gallery": {
"filter": {
"bool": {
"must": {
"function_score": { //same behaviour as top_reviews_gallery.filter.function_score
"functions": [
{
"filter": {
"term": {
"version" : "5.5.9"
}
},
"weight": 1000
}
]
}
}
}
},
"aggs": {
"media_items": {
"top_hits": {
"size": 100,
"sort": [
{
"timestamp.createdAt": {
"order": "desc"
}
}
]
}
}
}
}
}
}
}
}
}
}
I do not get any error but reviews with version attribute higher than 5.5.9 have higher score and are returned first