# Complex Queries across several indices

**URL:** <https://discuss.elastic.co/t/complex-queries-across-several-indices/125354>\
**Category:** Elasticsearch\
**Created:** [March 23, 2018, 11:06am UTC](https://discuss.elastic.co/t/complex-queries-across-several-indices/125354 "2018-03-23T11:06:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![JuergenMartin](https://avatars.discourse-cdn.com/v4/letter/j/bcef8e/32.png) [@JuergenMartin](https://discuss.elastic.co/u/JuergenMartin)\
**Post date:** [March 23, 2018, 11:06am UTC](https://discuss.elastic.co/t/complex-queries-across-several-indices/125354/1 "2018-03-23T11:06:50Z")

</div>

Hello Community,

we already use Elasticsearch / Kibana on a small scale for Logfiles.  
Because of its awesomeness we plan to replace Microsoft FAST Search  
in the near future (~150 million documents, ~7 TB index).  
So far, so good.

The long term vision of my Boss is replacing all complex database queries with ES.  
He wants to have an index for every business object. Meaning ~500 business  
objects result in ~500 different Indices. Then he wants ES to execute  
all complex searches, instead of the database. I have doubts that ES is capable  
of doing queries across different indices. Let me explain why.

A database query like "Get customers that received a delivery to a certain address  
managed by a certain department of our company" would join across  
four tables (customer, delivery, address, department).  
Every Business Object in this query is parameterized, meaning the customer,  
the address, the delivery or the department is given.  
Decades of RDBMS development made the database very good at optimizing such a query.  
Depending on the given parameters, it decides which table to query first  
and then join the other tables. As far as I know, Elasticsearch does not have such a  
cross indices query optimization feature.

This is just a very basic example of a query. In production we use several  
hundred autogenerated queries, some of them joining twenty or more tables having  
more than 60 Parameters. I can't see how ES could replace these query monsters.

As far as I understand, ES is document based and thus not intended to hold relations,  
not to speak of joining different indices. ES is awesome at executing complex  
queries on one index, but so far I couldn't find a way to query across several indices.

Am I just to blind to see the brilliance in my boss vision or is he overestimating  
the capabilities of Elasticsearch? What do you think?

Thanks for your thoughts

---

<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:** [April 20, 2018, 11:06am UTC](https://discuss.elastic.co/t/complex-queries-across-several-indices/125354/2 "2018-04-20T11:06:50Z")

</div>

Closed on April 20, 2018, 11:06am UTC

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
