I've successfully implemented nesting and inner_hits, which is great. However, I'm using Searchkit and the filters have built-in aggregators which are now showing aggregations over inner_hits, not their parent docs. From googling, I think reverse_nested
should fix this; I just can't figure out where to place it. This is what I've attempted:
"editions.rarity.raw163": {
"filter": {
...
},
"aggs": {
"inner": {
"nested": {
"path": "editions",
"reverse_nested": {}
},
"aggs": {
"editions.rarity.raw": {
"terms": {
"field": "editions.rarity.raw",
"size": 6
}
},
"editions.rarity.raw_count": {
"cardinality": {
"field": "editions.rarity.raw"
}
}
}
}
}
}
All of this is generated by Searchkit's code, I can access it before it gets sent to the ES server and modify it, which is how I've managed to insert my test reverse_nested
code. However right now it gives me a Bad Request
400 error, so I am clearly not putting this in the right place. Where should it go? The docs say it has to be in a nested query so that's where I put it.