# How to fetch data from multiple index using join like sql

**URL:** <https://discuss.elastic.co/t/how-to-fetch-data-from-multiple-index-using-join-like-sql/106131>\
**Category:** Elasticsearch\
**Created:** [November 2, 2017, 7:13am UTC](https://discuss.elastic.co/t/how-to-fetch-data-from-multiple-index-using-join-like-sql/106131 "2017-11-02T07:13:40Z")\
**Posts on this page:** 1\
**Showing post:** 6

<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 3, 2017, 9:51am UTC](https://discuss.elastic.co/t/how-to-fetch-data-from-multiple-index-using-join-like-sql/106131/6 "2017-11-03T09:51:28Z")

</div>

Please format your code using `</>` icon as explained in [this guide](https://discuss.elastic.co/t/about-the-elasticsearch-category/21). It will make your post more readable.

Or use markdown style like:

````
```
CODE
```

````

I edited your post.

In you example, what the user is searching for? users? blogposts?

Let say the later. Then index your documents as:

```auto
PUT /my_index/blogpost/1
{
  "title": "Relationships",
  "body": "It's complicated...",
  "user": {
    "name": "John Smith",
    "email": "john@smith.com",
    "dob": "1970/10/24"
  }
}

```

And you're done.

---

_[View the full topic](https://discuss.elastic.co/t/how-to-fetch-data-from-multiple-index-using-join-like-sql/106131)._
