# Different routing configs in a single query?

**URL:** https://discuss.elastic.co/t/different-routing-configs-in-a-single-query/14582
**Category:** Elasticsearch
**Created:** [November 25, 2013, 7:06pm UTC](https://discuss.elastic.co/t/different-routing-configs-in-a-single-query/14582 "2013-11-25T19:06:30Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![ppearcy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ppearcy/32/980_2.png) [@ppearcy](https://discuss.elastic.co/u/ppearcy)
#### Post date: [November 25, 2013, 7:06pm UTC](https://discuss.elastic.co/t/different-routing-configs-in-a-single-query/14582/1 "2013-11-25T19:06:30Z")

</div>

Hi All!  
I have a single query that spans over a set of per client private data  
using routing, as well as, a global dataset with no routing.

I would like to combine this into a single query, but end up needing to set  
different routing values per index, eg the private index has the clientid  
routing value and the global index does not have a routing value.

Is this currently possible? If not, any issues if I open a feature request?

My current workaround is to simply run two queries and merge those results.  
This approach doesn't work great with relevancy since the scores are  
computed in isolation and also make pagination painful.

Thanks!  
Paul

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [November 25, 2013, 7:25pm UTC](https://discuss.elastic.co/t/different-routing-configs-in-a-single-query/14582/2 "2013-11-25T19:25:19Z")

</div>

Hi Paul,

In that case, why do you specify routing value? If you don't set it when querying then all shards will be queried.

Could you elaborate a bit more?

--  
David 😉  
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 25 nov. 2013 à 20:06, ppearcy [ppearcy@gmail.com](mailto:ppearcy@gmail.com) a écrit :

> Hi All!  
> I have a single query that spans over a set of per client private data using routing, as well as, a global dataset with no routing.
> 
> I would like to combine this into a single query, but end up needing to set different routing values per index, eg the private index has the clientid routing value and the global index does not have a routing value.
> 
> Is this currently possible? If not, any issues if I open a feature request?
> 
> My current workaround is to simply run two queries and merge those results. This approach doesn't work great with relevancy since the scores are computed in isolation and also make pagination painful.
> 
> ## Thanks! Paul
> 
> You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

### Author: ![ppearcy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ppearcy/32/980_2.png) [@ppearcy](https://discuss.elastic.co/u/ppearcy)
#### Post date: [November 25, 2013, 7:27pm UTC](https://discuss.elastic.co/t/different-routing-configs-in-a-single-query/14582/3 "2013-11-25T19:27:21Z")

</div>

Hi David,  
I don't want to span all shards for the private index (so I use per  
client routing here), while I do for the global one (so, no routing  
specified here).

Thanks!

On Monday, November 25, 2013 2:25:19 PM UTC-5, David Pilato wrote:

> Hi Paul,
> 
> In that case, why do you specify routing value? If you don't set it when  
> querying then all shards will be queried.
> 
> Could you elaborate a bit more?
> 
> --  
> David 😉  
> Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
> 
> Le 25 nov. 2013 à 20:06, ppearcy \<[ppe...@gmail.com](mailto:ppe...@gmail.com) \<javascript:\>\> a  
> écrit :
> 
> Hi All!  
> I have a single query that spans over a set of per client private data  
> using routing, as well as, a global dataset with no routing.
> 
> I would like to combine this into a single query, but end up needing to  
> set different routing values per index, eg the private index has the  
> clientid routing value and the global index does not have a routing value.
> 
> Is this currently possible? If not, any issues if I open a feature  
> request?
> 
> My current workaround is to simply run two queries and merge those  
> results. This approach doesn't work great with relevancy since the scores  
> are computed in isolation and also make pagination painful.
> 
> Thanks!  
> Paul
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [November 25, 2013, 8:44pm UTC](https://discuss.elastic.co/t/different-routing-configs-in-a-single-query/14582/4 "2013-11-25T20:44:10Z")

</div>

I don't think you can do it at this time with the current API.  
No more idea so far :-/

--  
David 😉  
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 25 nov. 2013 à 20:27, ppearcy [ppearcy@gmail.com](mailto:ppearcy@gmail.com) a écrit :

Hi David,  
I don't want to span all shards for the private index (so I use per client routing here), while I do for the global one (so, no routing specified here).

Thanks!

> On Monday, November 25, 2013 2:25:19 PM UTC-5, David Pilato wrote:  
> Hi Paul,
> 
> In that case, why do you specify routing value? If you don't set it when querying then all shards will be queried.
> 
> Could you elaborate a bit more?
> 
> --  
> David 😉  
> Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
> 
> > Le 25 nov. 2013 à 20:06, ppearcy [ppe...@gmail.com](mailto:ppe...@gmail.com) a écrit :
> > 
> > Hi All!  
> > I have a single query that spans over a set of per client private data using routing, as well as, a global dataset with no routing.
> > 
> > I would like to combine this into a single query, but end up needing to set different routing values per index, eg the private index has the clientid routing value and the global index does not have a routing value.
> > 
> > Is this currently possible? If not, any issues if I open a feature request?
> > 
> > My current workaround is to simply run two queries and merge those results. This approach doesn't work great with relevancy since the scores are computed in isolation and also make pagination painful.
> > 
> > ## Thanks! Paul
> > 
> > You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

### Author: ![ppearcy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ppearcy/32/980_2.png) [@ppearcy](https://discuss.elastic.co/u/ppearcy)
#### Post date: [November 27, 2013, 3:43pm UTC](https://discuss.elastic.co/t/different-routing-configs-in-a-single-query/14582/5 "2013-11-27T15:43:50Z")

</div>

Thanks! FYI, I opened this request:

> <https://github.com/elastic/elasticsearch/issues/4272>
>
> I have a single query that spans over a index that has per client private data t…hat uses routing, as well as, a global index with shared data with no routing. 
> 
> I would like to combine this into a single query, but end up needing to set different routing values per index, eg the private index has the clientid routing value and the global index does not have a routing value. 
> 
> My current workaround is to simply run two queries and merge those results. This approach doesn't work great with relevancy since the scores are computed in isolation and also make pagination painful. 
> 
> Heres a brief discussion that might help if there is confusion:
> https://groups.google.com/forum/#!topic/elasticsearch/FwsOAHz80MU
> 
> This would be a nice to have, but definitely, not a priority.

It really is just a nice to have, but seems easy enough. I'd think a few  
others would have similar use cases.

Best Regards,  
Paul

On Monday, November 25, 2013 3:44:10 PM UTC-5, David Pilato wrote:

> I don't think you can do it at this time with the current API.  
> No more idea so far :-/
> 
> --  
> David 😉  
> Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
> 
> Le 25 nov. 2013 à 20:27, ppearcy \<[ppe...@gmail.com](mailto:ppe...@gmail.com) \<javascript:\>\> a  
> écrit :
> 
> Hi David,  
> I don't want to span all shards for the private index (so I use per  
> client routing here), while I do for the global one (so, no routing  
> specified here).
> 
> Thanks!
> 
> On Monday, November 25, 2013 2:25:19 PM UTC-5, David Pilato wrote:
> 
> > Hi Paul,
> > 
> > In that case, why do you specify routing value? If you don't set it when  
> > querying then all shards will be queried.
> > 
> > Could you elaborate a bit more?
> > 
> > --  
> > David 😉  
> > Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
> > 
> > Le 25 nov. 2013 à 20:06, ppearcy [ppe...@gmail.com](mailto:ppe...@gmail.com) a écrit :
> > 
> > Hi All!  
> > I have a single query that spans over a set of per client private data  
> > using routing, as well as, a global dataset with no routing.
> > 
> > I would like to combine this into a single query, but end up needing to  
> > set different routing values per index, eg the private index has the  
> > clientid routing value and the global index does not have a routing value.
> > 
> > Is this currently possible? If not, any issues if I open a feature  
> > request?
> > 
> > My current workaround is to simply run two queries and merge those  
> > results. This approach doesn't work great with relevancy since the scores  
> > are computed in isolation and also make pagination painful.
> > 
> > Thanks!  
> > Paul
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/8085b54c-2c57-4f71-88f9-1aa24e1efdf8%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/8085b54c-2c57-4f71-88f9-1aa24e1efdf8%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [July 6, 2017, 2:04am UTC](https://discuss.elastic.co/t/different-routing-configs-in-a-single-query/14582/6 "2017-07-06T02:04:32Z")

</div>


