# How to add custom document type to Elasticsearch indexing?

**URL:** <https://discuss.elastic.co/t/how-to-add-custom-document-type-to-elasticsearch-indexing/189880>\
**Category:** Elasticsearch\
**Created:** [July 10, 2019, 10:05pm UTC](https://discuss.elastic.co/t/how-to-add-custom-document-type-to-elasticsearch-indexing/189880 "2019-07-10T22:05:08Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![EZprogramming](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ezprogramming/32/57291_2.png) [@EZprogramming](https://discuss.elastic.co/u/EZprogramming)\
**Post date:** [July 10, 2019, 10:05pm UTC](https://discuss.elastic.co/t/how-to-add-custom-document-type-to-elasticsearch-indexing/189880/1 "2019-07-10T22:05:08Z")

</div>

Any idea how can I add the document\_type =\> "athena" to my index (stage-athena)? I am using Kibana dev-tool UI by the way.

`PUT /stage-athena/athena` didn't work!

Elasticsearch queries:

```
PUT /stage-athena/
PUT /stage-athena/_mapping
{
  "properties" : {
    "@timestamp" : {
      "type" : "date"
    },
    "@version" : {
      "type" : "text",
      "fields" : {
        "keyword" : {
          "type" : "keyword",
          "ignore_above" : 256
        }
      }
    },
    "customer_id" : {
      "type" : "text",
      "fields" : {
        "keyword" : {
          "type" : "keyword",
          "ignore_above" : 256
        }
      }
    },
    "farm_id" : {
      "type" : "text",
      "fields" : {
        "keyword" : {
          "type" : "keyword",
          "ignore_above" : 256
        }
      }
    },
    "machine_id" : {
      "type" : "text",
      "fields" : {
        "keyword" : {
          "type" : "keyword",
          "ignore_above" : 256
        }
      }
    },
    "op_date" : {
      "type" : "text",
      "fields" : {
        "keyword" : {
          "type" : "keyword",
          "ignore_above" : 256
        }
      }
    },
    "phase_id" : {
      "type" : "text",
      "fields" : {
        "keyword" : {
          "type" : "keyword",
          "ignore_above" : 256
        }
      }
    },
    "rows_captured" : {
      "type" : "long"
    },
    "type" : {
      "type" : "text",
      "fields" : {
        "keyword" : {
          "type" : "keyword",
          "ignore_above" : 256
        }
      }
    }
  }
}
```

---

<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:** [July 11, 2019, 2:29am UTC](https://discuss.elastic.co/t/how-to-add-custom-document-type-to-elasticsearch-indexing/189880/2 "2019-07-11T02:29:53Z")

</div>

I guess you're using 7.x. From this version you should not use any specific type anymore. Behind the scene the type we are using is `_doc`. It's better to keep this default value.

In 8.x the type will be completely gone.

---

<div class="post-metadata">

**Author:** ![EZprogramming](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ezprogramming/32/57291_2.png) [@EZprogramming](https://discuss.elastic.co/u/EZprogramming)\
**Post date:** [July 11, 2019, 6:50pm UTC](https://discuss.elastic.co/t/how-to-add-custom-document-type-to-elasticsearch-indexing/189880/3 "2019-07-11T18:50:26Z")

</div>

Yes, \_doc is the default document type. I am curious to know if it is useful to have different doucment types in an index?

---

<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:** [July 11, 2019, 7:18pm UTC](https://discuss.elastic.co/t/how-to-add-custom-document-type-to-elasticsearch-indexing/189880/4 "2019-07-11T19:18:43Z")

</div>

It's not and it's forbidden in 7.x anyway.

---

<div class="post-metadata">

**Author:** ![EZprogramming](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ezprogramming/32/57291_2.png) [@EZprogramming](https://discuss.elastic.co/u/EZprogramming)\
**Post date:** [July 11, 2019, 11:03pm UTC](https://discuss.elastic.co/t/how-to-add-custom-document-type-to-elasticsearch-indexing/189880/5 "2019-07-11T23:03:47Z")

</div>

Yes I'm using Elasticsearch 7.2, thanks for your feedback.

---

<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:** [August 8, 2019, 11:03pm UTC](https://discuss.elastic.co/t/how-to-add-custom-document-type-to-elasticsearch-indexing/189880/6 "2019-08-08T23:03:48Z")

</div>

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