# ES6.0: multiple types, indexes, relationships puzzle

**URL:** https://discuss.elastic.co/t/es6-0-multiple-types-indexes-relationships-puzzle/108984
**Category:** Elasticsearch
**Created:** [November 24, 2017, 7:32am UTC](https://discuss.elastic.co/t/es6-0-multiple-types-indexes-relationships-puzzle/108984 "2017-11-24T07:32:47Z")
**Posts on this page:** 1
**Showing post:** 2

<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 24, 2017, 7:54am UTC](https://discuss.elastic.co/t/es6-0-multiple-types-indexes-relationships-puzzle/108984/2 "2017-11-24T07:54:03Z")

</div>

> The challenge is, of course, in the relationships.

I agree. This is a challenge with a tool **which is not a relational database**.

To find the "best" way IMHO to do what you want to do in a efficient way (at search time), you need to ask yourself some questions:

- What my users are going to search for? Places? Events? Vouchers? News?
- What properties are needed for users to search such objects?

Let say you want to be able to search for Events and News.  
And that you want to be able to search for those per country or per shop name or per location of the place. Then index documents like this:

```auto
PUT event/doc/1
{
  "text": "This is my event 1",
  "place": {
    "country": "France",
    "shop": "My lovely shop",
    "location": {
      "lat": 49.0422777,
      "lon": 2.0290053
    } 
  }
}
PUT news/doc/1
{
  "text": "This is my fantastic news",
  "place": {
    "country": "France",
    "shop": "My lovely shop",
    "location": {
      "lat": 49.0422777,
      "lon": 2.0290053
    } 
  }
}

```

Would such a model work for you?

---

_[View the full topic](https://discuss.elastic.co/t/es6-0-multiple-types-indexes-relationships-puzzle/108984)._
