# Is there any known performance concern for query that spans multiple indexes?

**URL:** <https://discuss.elastic.co/t/is-there-any-known-performance-concern-for-query-that-spans-multiple-indexes/11675>\
**Category:** Elasticsearch\
**Created:** [April 23, 2013, 9:50pm UTC](https://discuss.elastic.co/t/is-there-any-known-performance-concern-for-query-that-spans-multiple-indexes/11675 "2013-04-23T21:50:25Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Connie\_Yang](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/connie_yang/32/1167_2.png) [@Connie\_Yang](https://discuss.elastic.co/u/Connie_Yang)\
**Post date:** [April 23, 2013, 9:50pm UTC](https://discuss.elastic.co/t/is-there-any-known-performance-concern-for-query-that-spans-multiple-indexes/11675/1 "2013-04-23T21:50:25Z")

</div>

I am considering creating a query that involves terms across two indexes in ElasticSearch. Is there any known performance concern for doing so?

For example, index1: termx. index2: terma

{  
"indices" : {  
"indices" : ["index1", "index2"],  
"query" : {  
"constant\_score" : {  
"filter" : {  
"bool" : {  
"must" : {  
"term" : {"termx" : "100x600"}  
},  
"must" : {  
"term" : {"terma" : "xyz"}  
}  
}  
}  
}  
}  
}  
}

Would this work?

Thanks,  
Connie

---

<div class="post-metadata">

**Author:** ![Igor\_Motov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igor_motov/32/45193_2.png) [@Igor\_Motov](https://discuss.elastic.co/u/Igor_Motov)\
**Post date:** [April 24, 2013, 8:48am UTC](https://discuss.elastic.co/t/is-there-any-known-performance-concern-for-query-that-spans-multiple-indexes/11675/2 "2013-04-24T08:48:34Z")

</div>

It would work, but it would be more efficient to just send this request to  
two indices by specifying these indices explicitly on URL if you are using  
REST API, or as indices parameter if you are using Java API:

curl localhost:9200/index1,index2/\_search -d '{  
"constant\_score" : {  
"filter" : {  
"bool" : {  
"must" : {  
"term" : {"termx" : "100x600"}  
},  
"must" : {  
"term" : {"terma" : "xyz"}  
}  
}  
}  
}  
}'

On Tuesday, April 23, 2013 11:50:25 PM UTC+2, Connie Yang wrote:

> I am considering creating a query that involves terms across two indexes  
> in  
> Elasticsearch. Is there any known performance concern for doing so?
> 
> For example, index1: termx. index2: terma
> 
> {  
> "indices" : {  
> "indices" : ["index1", "index2"],  
> "query" : {  
> "constant\_score" : {  
> "filter" : {  
> "bool" : {  
> "must" : {  
> "term" : {"termx" : "100x600"}  
> },  
> "must" : {  
> "term" : {"terma" : "xyz"}  
> }  
> }  
> }  
> }  
> }  
> }  
> }
> 
> Would this work?
> 
> Thanks,  
> Connie
> 
> --  
> View this message in context:  
> [http://elasticsearch-users.115913.n3.nabble.com/Is-there-any-known-performance-concern-for-query-that-spans-multiple-indexes-tp4033769.html](http://elasticsearch-users.115913.n3.nabble.com/Is-there-any-known-performance-concern-for-query-that-spans-multiple-indexes-tp4033769.html)  
> Sent from the Elasticsearch Users mailing list archive at [Nabble.com](http://Nabble.com).

--  
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:** ![Connie\_Yang](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/connie_yang/32/1167_2.png) [@Connie\_Yang](https://discuss.elastic.co/u/Connie_Yang)\
**Post date:** [April 24, 2013, 1:50pm UTC](https://discuss.elastic.co/t/is-there-any-known-performance-concern-for-query-that-spans-multiple-indexes/11675/3 "2013-04-24T13:50:27Z")

</div>

Thanks Igor!

Just to be sure, the query should work even if tese two indices are of two  
different types.

The attempt here is to find document primarily from index a based on a  
condition that exists in both indices.

Connie  
On Apr 24, 2013 1:48 AM, "Igor Motov-3 [via Elasticsearch Users]" \<  
[ml-node+s115913n4033784h87@n3.nabble.com](mailto:ml-node+s115913n4033784h87@n3.nabble.com)\> wrote:

> It would work, but it would be more efficient to just send this request to  
> two indices by specifying these indices explicitly on URL if you are using  
> REST API, or as indices parameter if you are using Java API:
> 
> curl localhost:9200/index1,index2/\_search -d '{  
> "constant\_score" : {  
> "filter" : {  
> "bool" : {  
> "must" : {  
> "term" : {"termx" : "100x600"}  
> },  
> "must" : {  
> "term" : {"terma" : "xyz"}  
> }  
> }  
> }  
> }  
> }'
> 
> On Tuesday, April 23, 2013 11:50:25 PM UTC+2, Connie Yang wrote:
> 
> > I am considering creating a query that involves terms across two indexes  
> > in  
> > Elasticsearch. Is there any known performance concern for doing so?
> > 
> > For example, index1: termx. index2: terma
> > 
> > {  
> > "indices" : {  
> > "indices" : ["index1", "index2"],  
> > "query" : {  
> > "constant\_score" : {  
> > "filter" : {  
> > "bool" : {  
> > "must" : {  
> > "term" : {"termx" : "100x600"}  
> > },  
> > "must" : {  
> > "term" : {"terma" : "xyz"}  
> > }  
> > }  
> > }  
> > }  
> > }  
> > }  
> > }
> > 
> > Would this work?
> > 
> > Thanks,  
> > Connie
> > 
> > --  
> > View this message in context: [http://elasticsearch-users](http://elasticsearch-users).\*\*  
> > [115913.n3.nabble.com/Is-there-](http://115913.n3.nabble.com/Is-there-) **any-known-performance-concern-**  
> > for-query-that-spans-multiple-\*\*indexes-tp4033769.html[http://elasticsearch-users.115913.n3.nabble.com/Is-there-any-known-performance-concern-for-query-that-spans-multiple-indexes-tp4033769.html](http://elasticsearch-users.115913.n3.nabble.com/Is-there-any-known-performance-concern-for-query-that-spans-multiple-indexes-tp4033769.html)  
> > Sent from the Elasticsearch Users mailing list archive at [Nabble.com](http://Nabble.com).
> 
> --  
> 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 [hidden email][http://user/SendEmail.jtp?type=node&node=4033784&i=0](http://user/SendEmail.jtp?type=node&node=4033784&i=0)  
> .  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> 
> * * *
> 
> If you reply to this email, your message will be added to the discussion  
> below:
> 
> [http://elasticsearch-users.115913.n3.nabble.com/Is-there-any-known-performance-concern-for-query-that-spans-multiple-indexes-tp4033769p4033784.html](http://elasticsearch-users.115913.n3.nabble.com/Is-there-any-known-performance-concern-for-query-that-spans-multiple-indexes-tp4033769p4033784.html)  
> To start a new topic under Elasticsearch Users, email  
> [ml-node+s115913n115913h86@n3.nabble.com](mailto:ml-node+s115913n115913h86@n3.nabble.com)  
> To unsubscribe from Is there any known performance concern for query that  
> spans multiple indexes?, click here[http://elasticsearch-users.115913.n3.nabble.com/template/NamlServlet.jtp?macro=unsubscribe\_by\_code&node=4033769&code=Y3liZXJjb25uaWVAZ21haWwuY29tfDQwMzM3Njl8LTIxMjk4ODk4MTQ=](http://elasticsearch-users.115913.n3.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4033769&code=Y3liZXJjb25uaWVAZ21haWwuY29tfDQwMzM3Njl8LTIxMjk4ODk4MTQ=)  
> .  
> NAML[http://elasticsearch-users.115913.n3.nabble.com/template/NamlServlet.jtp?macro=macro\_viewer&id=instant\_html!nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify\_subscribers!nabble%3Aemail.naml-instant\_emails!nabble%3Aemail.naml-send\_instant\_email!nabble%3Aemail.naml](http://elasticsearch-users.115913.n3.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml)

---

<div class="post-metadata">

**Author:** ![Igor\_Motov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igor_motov/32/45193_2.png) [@Igor\_Motov](https://discuss.elastic.co/u/Igor_Motov)\
**Post date:** [April 25, 2013, 8:29am UTC](https://discuss.elastic.co/t/is-there-any-known-performance-concern-for-query-that-spans-multiple-indexes/11675/4 "2013-04-25T08:29:59Z")

</div>

Yes, these indices don't have to have the same mapping.

On Wednesday, April 24, 2013 3:50:41 PM UTC+2, Connie Yang wrote:

> Thanks Igor!
> 
> Just to be sure, the query should work even if tese two indices are of two  
> different types.
> 
> The attempt here is to find document primarily from index a based on a  
> condition that exists in both indices.
> 
> Connie  
> On Apr 24, 2013 1:48 AM, "Igor Motov-3 [via Elasticsearch Users]" \<[hidden  
> email] [http://user/SendEmail.jtp?type=node&node=4033797&i=0](http://user/SendEmail.jtp?type=node&node=4033797&i=0)\> wrote:
> 
> > It would work, but it would be more efficient to just send this request  
> > to two indices by specifying these indices explicitly on URL if you are  
> > using REST API, or as indices parameter if you are using Java API:
> > 
> > curl localhost:9200/index1,index2/\_search -d '{  
> > "constant\_score" : {  
> > "filter" : {  
> > "bool" : {  
> > "must" : {  
> > "term" : {"termx" : "100x600"}  
> > },  
> > "must" : {  
> > "term" : {"terma" : "xyz"}  
> > }  
> > }  
> > }  
> > }  
> > }'
> > 
> > On Tuesday, April 23, 2013 11:50:25 PM UTC+2, Connie Yang wrote: I am  
> > considering creating a query that involves terms across two indexes in  
> > Elasticsearch. Is there any known performance concern for doing so?
> > 
> > For example, index1: termx. index2: terma
> > 
> > {  
> > "indices" : {  
> > "indices" : ["index1", "index2"],  
> > "query" : {  
> > "constant\_score" : {  
> > "filter" : {  
> > "bool" : {  
> > "must" : {  
> > "term" : {"termx" : "100x600"}  
> > },  
> > "must" : {  
> > "term" : {"terma" : "xyz"}  
> > }  
> > }  
> > }  
> > }  
> > }  
> > }  
> > }
> > 
> > Would this work?
> > 
> > Thanks,  
> > Connie
> > 
> > --  
> > View this message in context: [http://elasticsearch-users](http://elasticsearch-users).\*\*  
> > [115913.n3.nabble.com/Is-there-](http://115913.n3.nabble.com/Is-there-) **any-known-performance-concern-**  
> > for-query-that-spans-multiple-\*\*indexes-tp4033769.html[http://elasticsearch-users.115913.n3.nabble.com/Is-there-any-known-performance-concern-for-query-that-spans-multiple-indexes-tp4033769.html](http://elasticsearch-users.115913.n3.nabble.com/Is-there-any-known-performance-concern-for-query-that-spans-multiple-indexes-tp4033769.html)  
> > Sent from the Elasticsearch Users mailing list archive at [Nabble.com](http://Nabble.com).
> 
> --  
> 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 [hidden email][http://user/SendEmail.jtp?type=node&node=4033784&i=0](http://user/SendEmail.jtp?type=node&node=4033784&i=0)  
> .  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> 
> * * *
> 
> If you reply to this email, your message will be added to the discussion  
> below:
> 
> [http://elasticsearch-users.115913.n3.nabble.com/Is-there-any-known-performance-concern-for-query-that-spans-multiple-indexes-tp4033769p4033784.html](http://elasticsearch-users.115913.n3.nabble.com/Is-there-any-known-performance-concern-for-query-that-spans-multiple-indexes-tp4033769p4033784.html)  
> To start a new topic under Elasticsearch Users, email [hidden email][http://user/SendEmail.jtp?type=node&node=4033797&i=1](http://user/SendEmail.jtp?type=node&node=4033797&i=1)  
> To unsubscribe from Is there any known performance concern for query that  
> spans multiple indexes?, click here.  
> NAML[http://elasticsearch-users.115913.n3.nabble.com/template/NamlServlet.jtp?macro=macro\_viewer&id=instant\_html!nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify\_subscribers!nabble%3Aemail.naml-instant\_emails!nabble%3Aemail.naml-send\_instant\_email!nabble%3Aemail.naml](http://elasticsearch-users.115913.n3.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml)
> 
> * * *
> 
> View this message in context: Re: Is there any known performance concern  
> for query that spans multiple indexes?[http://elasticsearch-users.115913.n3.nabble.com/Is-there-any-known-performance-concern-for-query-that-spans-multiple-indexes-tp4033769p4033797.html](http://elasticsearch-users.115913.n3.nabble.com/Is-there-any-known-performance-concern-for-query-that-spans-multiple-indexes-tp4033769p4033797.html)  
> Sent from the Elasticsearch Users mailing list archive[http://elasticsearch-users.115913.n3.nabble.com/](http://elasticsearch-users.115913.n3.nabble.com/)at [Nabble.com](http://Nabble.com).

--  
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:** ![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:39am UTC](https://discuss.elastic.co/t/is-there-any-known-performance-concern-for-query-that-spans-multiple-indexes/11675/5 "2017-07-06T02:39:42Z")

</div>


