There are two main ways to decrease the size of records:
Generally you’ll want to split the records into smaller slices when you have one attribute that on your record that is especially large. This commonly happens with records built around textual content, like blog posts or PDFs.
In this case, the best thing to do is to split that attribute by paragraph and create records that are duplicates in every way except they have their own unique paragraph and their own unique objectID. For the objectID, you can take the objectID of the original record and append the paragraph number, so for example “12345” becomes “12345-0” and so on.
We must duplicate the data because Algolia does not have relationships between records and must be denormalized.
Let’s imagine we have a blog and a user is searching something that might match a blog post through its title. We don’t want multiple results to turn up when a user is searching.
Instead we only want the best result. Set attributeForDistinct to an attribute that all of the records from a single post have in common with each other and no others. A good example would be the slug of the blog post.
Then, when querying Algolia, set distinct to true. Then only the best matching result from each blog post will appear, leading to more diversity in the results.