# Filtering based on data in multiple indexes

**URL:** <https://discuss.elastic.co/t/filtering-based-on-data-in-multiple-indexes/9306>\
**Category:** Elasticsearch\
**Created:** [October 10, 2012, 1:32pm UTC](https://discuss.elastic.co/t/filtering-based-on-data-in-multiple-indexes/9306 "2012-10-10T13:32:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Derry\_O\_Sullivan](https://avatars.discourse-cdn.com/v4/letter/d/7bcc69/32.png) [@Derry\_O\_Sullivan](https://discuss.elastic.co/u/Derry_O_Sullivan)\
**Post date:** [October 10, 2012, 1:32pm UTC](https://discuss.elastic.co/t/filtering-based-on-data-in-multiple-indexes/9306/1 "2012-10-10T13:32:52Z")

</div>

Hi all,

I'm designing an elasticsearch index 'schema' (need to get out of this  
database lingo!) where i need to expose searches based on relationships  
among documents.

If i have a user (object1) who likes a collection (object2) of documents  
(object3), is it better to have 1 index with 3 types for each object or 1  
index to represent the 3 types?

I know that filtering allows you to do 'where' (SQL analogy) queries but  
that seems to be on a single index - how do i make this kind of  
relationship work among multiple object types (in 1 or multiple indexes).

Many thanks,

Derry

--

---

<div class="post-metadata">

**Author:** ![Derry\_O\_Sullivan](https://avatars.discourse-cdn.com/v4/letter/d/7bcc69/32.png) [@Derry\_O\_Sullivan](https://discuss.elastic.co/u/Derry_O_Sullivan)\
**Post date:** [October 10, 2012, 2:30pm UTC](https://discuss.elastic.co/t/filtering-based-on-data-in-multiple-indexes/9306/2 "2012-10-10T14:30:09Z")

</div>

Just to add to this, not all the fields will be query data - (we may store  
some of the fields in a DB and use ES as a lookup). The point is that we  
want to use ES to expose fields that are searchable.

If we can perform all the functionality within ES, it would be great but  
understand that we may need client side combination logic or jumping out to  
a (No)SQL type structure.

On Wednesday, 10 October 2012 14:32:52 UTC+1, Derry O' Sullivan wrote:

> Hi all,
> 
> I'm designing an elasticsearch index 'schema' (need to get out of this  
> database lingo!) where i need to expose searches based on relationships  
> among documents.
> 
> If i have a user (object1) who likes a collection (object2) of documents  
> (object3), is it better to have 1 index with 3 types for each object or 1  
> index to represent the 3 types?
> 
> I know that filtering allows you to do 'where' (SQL analogy) queries but  
> that seems to be on a single index - how do i make this kind of  
> relationship work among multiple object types (in 1 or multiple indexes).
> 
> Many thanks,
> 
> Derry

--

---

<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, 3:09am UTC](https://discuss.elastic.co/t/filtering-based-on-data-in-multiple-indexes/9306/3 "2017-07-06T03:09:24Z")

</div>


