Thanks for answering my questions on shardkey. We experimented with implicit 
router and it works like you said. 

We're experimenting with composite id router. This document 
http://searchhub.org/2013/06/13/solr-cloud-document-routing/ says:
"A shard key can be pre-pended to the unique document id to create a composite 
id. The composite id is formed with the following syntax: shard_key!document_id"

Say this is our CSV data and q_idn_s is unique id per document. 

|q_idn_s |busdate |put_date            
|test_14  |20130611|02/06/2013  16:06:24
|test_15  |20130611|02/06/2013  16:06:24

Now we want to use busdate!q_idn_s as composite key. So we changed our data 
like this:

|q_idn_s |busdate |put_date            
|20130611!test_14  |20130611|02/06/2013  16:06:24
|20130611!test_15  |20130611|02/06/2013  16:06:24

And uploaded this data like this:

echo "$data" curl --proxy ""  
"http://$HOST:8983/solr/collection1/update/csv?commit=true&separator=|&escape=\&trim=true&header=false&skipLines=2&overwrite=true&fieldnames=$fieldnames&"
  --data-binary @-  -H 'Content-type:text/plain; charset=utf-8'

But now Solr stores composite id in the document id (q_idn_s) column.  We were 
under impression that Solr won't store shard_key! in the document id column. It 
would only use it to calculate hash key but while storing, it would only store 
the document id. Is it not the case?



-----Original Message-----
From: Shalin Shekhar Mangar [mailto:shalinman...@gmail.com] 
Sent: Monday, June 17, 2013 3:48 PM
To: solr-user@lucene.apache.org
Subject: Re: shardkey

No, there is no way to do that right now. I think you'd be better off using
custom sharding because you can't really control that two shardKeys must go
to two different shards. We can only guarantee that docs with the same
shardKey will goto the same shard.


On Mon, Jun 17, 2013 at 9:47 PM, Joshi, Shital <shital.jo...@gs.com> wrote:

> Thanks for the links. It was very useful.
>
> Is there a way to use implicit router WITH numShards parameter? We have 5
> shards and business day (Monday-Friday) is our shardkey. We want to be able
> to say Monday -> shard1, Tuesday -> shard2.....
>
>
>
>
> -----Original Message-----
> From: Joel Bernstein [mailto:joels...@gmail.com]
> Sent: Thursday, June 13, 2013 2:38 PM
> To: solr-user@lucene.apache.org
> Subject: Re: shardkey
>
> Also you might want to check this blog post, just went up today.
>
> http://searchhub.org/2013/06/13/solr-cloud-document-routing/
>
>
> On Wed, Jun 12, 2013 at 2:18 PM, James Thomas <jtho...@camstar.com> wrote:
>
> > This page has some good information on custom document routing:
> >
> >
> http://docs.lucidworks.com/display/solr/Shards+and+Indexing+Data+in+SolrCloud
> >
> >
> >
> > -----Original Message-----
> > From: Rishi Easwaran [mailto:rishi.easwa...@aol.com]
> > Sent: Wednesday, June 12, 2013 1:40 PM
> > To: solr-user@lucene.apache.org
> > Subject: Re: shardkey
> >
> > From my understanding.
> > In SOLR cloud the CompositeIdDocRouter uses HashbasedDocRouter.
> > CompositeId router is default if your numShards>1 on collection creation.
> > CompositeId router generates an hash using the uniqueKey defined in your
> > schema.xml to route your documents to a dedicated shard.
> >
> > You can use select?q=xyz&shard.keys=uniquekey to focus your search to hit
> > only the shard that has your shard.key
> >
> >
> >
> >  Thanks,
> >
> > Rishi.
> >
> >
> >
> > -----Original Message-----
> > From: Joshi, Shital <shital.jo...@gs.com>
> > To: 'solr-user@lucene.apache.org' <solr-user@lucene.apache.org>
> > Sent: Wed, Jun 12, 2013 10:01 am
> > Subject: shardkey
> >
> >
> > Hi,
> >
> > We are using Solr 4.3.0 SolrCloud (5 shards, 10 replicas). I have couple
> > questions on shard key.
> >
> >         1. Looking at the admin GUI, how do I know which field is being
> > used for shard key.
> >         2. What is the default shard key used?
> >         3. How do I override the default shard key?
> >
> > Thanks.
> >
> >
> >
>
>
> --
> Joel Bernstein
> Professional Services LucidWorks
>



-- 
Regards,
Shalin Shekhar Mangar.

Reply via email to