Personally I’d use a character delimited value in one field for the nests. Same way as flattening a relational table. version_major:1, version_minor:2
And for the multi valued drinks field just the name field assuming the type will always be drink anyways. Drink1, drink2 etc Just initial thoughts. If there are more fields in the multi valued field, you need to get creative. Go from search backwards to the document. And yeah storing the entire thing into a single string is really clever as far as retrieval and display. Can’t hurt to start there, and then evaluate what you’re searching for and what you want to facet against (same thing) to come up with the other fields. -Dave > On Aug 9, 2022, at 7:18 AM, Eric Pugh <ep...@opensourceconnections.com> wrote: > > I feel like the Solr Ref Guide ought to weigh in on this ;-). I’ll be > curious what other folks say? > > I know for json that I am storing (but not searching), that I like to just > store it as a string, and use the JSON transformer to convert it back to > native JSON in my response when I use wt=json. > https://solr.apache.org/guide/solr/latest/query-guide/document-transformers.html#json-xml > > <https://solr.apache.org/guide/solr/latest/query-guide/document-transformers.html#json-xml> > for more info. > > > >> On Aug 9, 2022, at 6:13 AM, Adam Raźniewski <adam.razniew...@gmail.com> >> wrote: >> >> Hello fellow SOLR community! >> >> I have a question regarding best practices to store nested JSON objects. >> >> >> So imagine that i have an object: >> { >> "name": "test" >> "version": { >> "major": 1, >> "minor": 3, >> "patch": 4 >> } >> "drinks: [ { >> "name": "drink1", >> "type": "drink" >> }] >> } >> >> How would you proceed with such document? >> How to properly index it? >> Are there some best practices? >> >> >> Have a nice day, >> Adam > > _______________________ > Eric Pugh | Founder & CEO | OpenSource Connections, LLC | 434.466.1467 | > http://www.opensourceconnections.com <http://www.opensourceconnections.com/> > | My Free/Busy <http://tinyurl.com/eric-cal> > Co-Author: Apache Solr Enterprise Search Server, 3rd Ed > <https://www.packtpub.com/big-data-and-business-intelligence/apache-solr-enterprise-search-server-third-edition-raw> > > This e-mail and all contents, including attachments, is considered to be > Company Confidential unless explicitly stated otherwise, regardless of > whether attachments are marked as such. >