I am using the free tier of Bonsai and am trying to write a script to manage the number of documents in my Elastic index. To maximize the number of documents I can save, I would like to start removing docs for which there are many nested documents within.
Example:
{
"title": "Spiderman saves child from well",
"body": "Move over, Lassie! New York has a new hero. But is he also a menace?",
"authors": [
{
"name": "Jonah Jameson",
"title": "Sr. Editor",
},
{
"name": "Peter Parker",
"title": "Photos",
}
],
"comments": [
{
"username": "captain_usa",
"comment": "I understood that reference!",
},
{
"username": "man_of_iron",
"comment": "Congrats on being slightly more useful than a ladder.",
}
],
"photos": [
{
"url": "https://assets.dailybugle.com/12345",
"caption": "Spiderman delivering Timmy back to his mother",
}
]
}
Is there anything in Elastic that would tell me that this document is really 6 documents because of the extensive nesting? Ideally, I would be able to sort elastic records by this "document count".
Thanks!