Hint: you can easily try out streaming expressions in the admin UI
> Am 03.06.2020 um 07:32 schrieb Jörn Franke <jornfra...@gmail.com>: > > > You are trying to achieve data locality by having parents and children in the > same shard? > Does document routing address it? > > https://lucene.apache.org/solr/guide/8_5/shards-and-indexing-data-in-solrcloud.html#document-routing > > > On a side node, I don’t know your complete use case, but have you explored > streaming expressions for graph traversal? > > https://lucene.apache.org/solr/guide/8_5/graph-traversal.html > > >>> Am 03.06.2020 um 00:37 schrieb sambasivarao giddaluri >>> <sambasiva.giddal...@gmail.com>: >>> >> Hi All, >> I am running solr in cloud mode in local with 2 shards and 2 replica on >> port 8983 and 7574 and figuring out how to insert document in to a >> particular shard , I read about implicit and composite route but i don't >> think it will work for my usecase. >> >> shard1 : http://192.168.0.112:8983/family_shard1_replica_n1 >> http://192.168.0.112:7574/family_shard1_replica_n2 >> >> shard2: http://192.168.0.112:8983/family_shard2_replica_n3 >> http://192.168.0.112:7574/family_shard2_replica_n4 >> >> we have documents with parent child relationship but flatten out with 2 >> levels down and reference to each other. >> family schema documents: >> { >> "Id":"1" >> "document_type":"parent" >> "name":"John" >> } >> { >> "Id":"2" >> "document_type":"child" >> "parentId":"1" >> "name":"Rodney" >> } >> { >> "Id":"3" >> "document_type":"child" >> "parentId":"1" >> "name":"George" >> } >> { >> "Id":"4" >> "document_type":"grandchild" >> "parentId":"1", >> "childIdId":"2" >> "name":"David" >> } >> we have complex queries to get data based on graph query parser and as >> graph query parser does not work on solr cloud with multiple shards. I was >> trying to develop a logic like whenever a document gets inserted or updated >> make sure it gets saved in the same shard where the parent doc is stored , >> in that way graph query works because all the family information will be in >> the same shard. >> Approach : >> 1) If a new child/grandchild is getting inserted then get the parent doc >> shard details and add the shard details to the document in a field >> ex:parentshard and save the doc in the shard. >> 2) If document is getting updated check if the parentshard field exists if >> so update the doc to same shard. >> But all these check conditions will increase response time , currently our >> development is done in cloud mode with single shard and using solrj to >> save the data. >> Also i an unable to figure out the query to update doc to a particular >> shard. >> >> Any suggestions will help . >> >> Thanks in Advance >> sam