# Elasticsearch join query

**URL:** https://discuss.elastic.co/t/elasticsearch-join-query/97942
**Category:** Elasticsearch
**Created:** [August 22, 2017, 4:32pm UTC](https://discuss.elastic.co/t/elasticsearch-join-query/97942 "2017-08-22T16:32:13Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![lask001](https://avatars.discourse-cdn.com/v4/letter/l/4da419/32.png) [@lask001](https://discuss.elastic.co/u/lask001)
#### Post date: [August 22, 2017, 4:32pm UTC](https://discuss.elastic.co/t/elasticsearch-join-query/97942/1 "2017-08-22T16:32:14Z")

</div>

I don't think it's possible to do what I'm trying to accomplish, but I thought I'd see if anyone has any ideas before I give up.

Here are what my documents look like:

```
  "hits": {
    "total": 2,
    "max_score": 10.277645,
    "hits": [
      {
        "_index": "test",
        "_type": "test",
        "_id": "test",
        "_score": 10.277645,
        "_source": {
          "process_id": "1234test",
          "user": "jsmith"
        }
      },
      {
        "_index": "test",
        "_type": "test,
        "_id": "test",
        "_score": 10.277599,
        "_source": {
          "time_took_in_ms": 150,
          "process_id": "1234test"
        }
      }
    ]
  }

```

My goal is to get a document returned that looks something like this:

```
{
  "_index": "test",
  "_type": "test,
  "_id": "test",
  "_score": 10.277599,
  "_source": {
    "time_took_in_ms": 150,
    "user": "jsmith",
    "process_id": "1234test"
  }
}

```

I don't want to have to provide the process\_id though; I want to be able to query the entire index and join all results like this. Is this possible and if so could someone point me in the right direction?

---

<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: [September 19, 2017, 4:32pm UTC](https://discuss.elastic.co/t/elasticsearch-join-query/97942/2 "2017-09-19T16:32:23Z")

</div>

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