# ES 6.0 1 type 1 index issues

**URL:** https://discuss.elastic.co/t/es-6-0-1-type-1-index-issues/109291
**Category:** Elasticsearch
**Created:** [November 27, 2017, 11:32pm UTC](https://discuss.elastic.co/t/es-6-0-1-type-1-index-issues/109291 "2017-11-27T23:32:37Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![iti](https://avatars.discourse-cdn.com/v4/letter/i/b19c9b/32.png) [@iti](https://discuss.elastic.co/u/iti)
#### Post date: [November 27, 2017, 11:32pm UTC](https://discuss.elastic.co/t/es-6-0-1-type-1-index-issues/109291/1 "2017-11-27T23:32:38Z")

</div>

```
Currently, my ES(5.6.3) mapping is like this:

Index: 
          Parent Type,
          Child Type 1,
          Child Type 2,
          ........
          Child Type 70

Each Child Type has its own nested documents. Parent Type and Child Type have a common Key (ID). So, using has has_child or has_parent is very convenient.

With 1 type 1 index, they are 2 ways to convert it:
1. create total of 71 indexes with 1 type.
2. create a custom "type" field and lump all fields in each parent/child type into one type.(Very ugly, we are talking about 800 fields.)

My question is, with above 2 choices, how do you query for parent type if any child type has a matching?
Previously can be done in 1 query:
    GET /index/parent type/_search
        {
          "size": 500,
          "query": {
            "bool": {
              "should": [
                {
                  "bool": {
                    "must": {
                      "has_child": {
                        "type": "child type 1",
                        "query": {
                          "match": {
                            "key": "xxxxx"
                          }
                        },
                        "inner_hits": {
                          "size": 500
                        }
                      }
                    }
                  }
                },
                {
          "bool": {
            "must": {
              "has_child": {
                "type": "Child type 2",
                "query": {
                  "match": {
                    "key": "xxxxx"
                  }
                },
                "inner_hits": {
                  "size": 500
                }
              }
            }
          }
        },
        ....
        }

Also, how do you create a new Index for the Child Type(choice 1)? (Parent type is OK)

Using reindex API to reindex Child Type:
    POST _reindex
    {
      "source": {
        "index": "index",
        "type": "child type 1"
      },
      "dest": {
        "index": "child type 1"  
      }
    }
     I got:
          "cause": {
            "type": "illegal_argument_exception",
            "reason": "can't specify parent if no parent field has been configured"
          },
          "status": 400
Anyone know how to reindex a child type? (Type with parent defined)

Thanks
```

---

<div class="post-metadata">

### Author: ![iti](https://avatars.discourse-cdn.com/v4/letter/i/b19c9b/32.png) [@iti](https://discuss.elastic.co/u/iti)
#### Post date: [December 7, 2017, 9:04pm UTC](https://discuss.elastic.co/t/es-6-0-1-type-1-index-issues/109291/2 "2017-12-07T21:04:57Z")

</div>

This question was answered in the following post

> [@ES6.0: multiple types, indexes, relationships puzzle](https://discuss.elastic.co/t/es6-0-multiple-types-indexes-relationships-puzzle/108984/14):
>
> There is no way to do joins between two separate indexes in Elasticsearch. One type per index and then doing joins between those indexes is not possible and I don't see it happening in the foreseeable future. That's just not how Elasticsearch works. The only way that your use case is going to work is by normalizing to a single document type using the join field as I have described in my earlier post. To answer your first question: yes, unfortunately it's not easy to check individual child mappi…

---

<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: [January 4, 2018, 9:05pm UTC](https://discuss.elastic.co/t/es-6-0-1-type-1-index-issues/109291/3 "2018-01-04T21:05:06Z")

</div>

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