Search code examples
solrroutessolrcloud

Solr Cloud 6.4.0 Document routing compositeID does not route to another shard


I am completely confused about what is going on in my SolrCloud setup. That said, you see I am new to the topic.

My current setup for testing is: I have created a SolrCloud on a single server (I do not have more for testing in the moment). I use the embedded Zookeeper. I have three shards on three nodes with two replica in each one. Every node has a different IP (8984,7574,7575).

I set up a collection with

curl 'http://localhost:8984/solr/admin/collections?action=CREATE&name=mycollection&numShards=3&replicationFactor=2&collection.configName=myconfigset&router.name=compositeId'

When I index some Documents with

curl 'http://localhost:8984/solr/mycollection/update/csv?update.chain=all-into-one&commit=true&separator=%09&encapsulator=%00&header=true&trim=true&f.itau_name3.split=true&f.itau_name3.separator=;&f.itau_lnx3.split=true&f.itau_lnx3.separator=;&f.itau_af3.split=true&f.itau_af3.separator=;&f.itau_init3.split=true&f.itau_init3.separator=;' --data-binary @file.txt -H 'Content-type:text/plain; charset=utf-8'

the routing works ... sometimes. It seems to depend on the prefix/compositeID I use:

When I use r1!<uniquekey>, r2!<uniquekey>, r3!<uniquekey> a query : with _route_=r1! returns documents with r1 and r2 prefix. _route_=r3! seems to be correctly routed. In the very same setup (after clearing the index and reindexing) the same with year1!, year2!, year3! as prefixes works. A query with q=*:*&_route_=year1! etc. only returns results of the respective route-prefix.

Can somebody help me to find out what's going on here? Are there any restrictions on what how to construct the route-prefix?


Solution

  • you did not show your full query, but, I suspect this might be happening:

    1. when you query with route=r1! you are not adding an fq=r_field:r1
    2. route=r1! only tells Solr what shard to query, but this does not exclude other r field values (like r2 and r3) that are ALSO indexed in that same shard, that is why you need to add the fq

    Does this make sense?