malejpavouk
malejpavouk

Reputation: 4445

Apache Solr: Custom document router

I am trying to implement sharding by date in my application. I know that in Solr cloud I can achieve routing to specific shard using compositeId router.

But this approach leads to pre-configured number of shards (or writing a shard splitting logic - not too hard, but cumbersome).

I was wondering if it would be possible to write a custom router as a Java class and provide it to Solr? The custom router would simple create new shard whenever the time is right (example: new month) and route new documents directly to it.

Is this possible? Or are there any resources how to achieve this? (I took a look into docs and there is not mention...)

Upvotes: 1

Views: 522

Answers (1)

Persimmonium
Persimmonium

Reputation: 15789

I would'nt go that route. I advise you study carefully the work being done at Time partitioned collections. This is not complete yet, so maybe you cannot use it in the best way, but many of the building pieces are done, so you should be able to leverage most of them. Then, in the future, you could hopefully move to the full built in feature.

Upvotes: 2

Related Questions