Routing on multiple fields


(Ridvan Gyundogan) #1

Hi I have the following scenario and I need some help with the
routing.
my documents have the following structure
Doc{
userId:String
username:String
.....
}

When indexing I always have userId, sometimes I have username.

When searching I have userId or username or both. The relation userId
to username is M:1 , several userIds can belong to the same username,
don't ask me why :wink:

I want to use the benefits of routing when searching which looks
possible in my scenario.

I was thinking to index based on routing on userId .
When the search contains userid - it is all fine.
When the search contains only username though I need to specify all
the userids belonging to the specific username. So for this I need
another search request to find the username's userids.

Any idea how to avoid this extra request for finding username's
userids?


(system) #2