Search code examples
solrshardingsolrcloud

How to Split Solr collection into shards based on Date field


I'm trying to split my solrcloud collection into shards based on date field. ie, Documents should be routed to different shards based on the year in the date field. As of now im using compositeid sharding. How can i approach this ?


Solution

  • then you just use the following compositeId:

    • assume tid is the field of the doc uniquely identifying it
    • extract the YEAR from the date
    • compositeid is: YEAR!tid