# The state of 'types' in elasticsearch 7

**URL:** https://discuss.elastic.co/t/the-state-of-types-in-elasticsearch-7/310146
**Category:** Elasticsearch
**Tags:** language-clients
**Created:** [July 20, 2022, 12:28pm UTC](https://discuss.elastic.co/t/the-state-of-types-in-elasticsearch-7/310146 "2022-07-20T12:28:19Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![sbruinsje](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sbruinsje/32/108568_2.png) [@sbruinsje](https://discuss.elastic.co/u/sbruinsje)
#### Post date: [July 20, 2022, 12:28pm UTC](https://discuss.elastic.co/t/the-state-of-types-in-elasticsearch-7/310146/1 "2022-07-20T12:28:20Z")

</div>

I am using Elasticsearch 7.17 and the corresponding javacript client `@elastic/elasticsearch@7.17`. My understanding is that only one type of document can be stored in an index and as such specifying explicit types is deprecated when indexing documents.

However when indexing a document using the javascript client I get this error:

```auto
ConfigurationError: Missing required parameter: type

```

The stack trace of the error points to this block of code:

```auto
await client.index({
  index: indexName,
  id: obj.id,
  body: obj.body,
});

```

It turns out that if I add `type: '_doc'`, it works:

```auto
await client.index({
  index: indexName,
  type: '_doc',
  id: obj.id,
  body: obj.body,
});

```

Which is strange because the client docs say the type field is deprecated and they don't include the type in their examples either.

Is this a mistake in the javascript client or am I overlooking something?

---

<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 17, 2022, 12:28pm UTC](https://discuss.elastic.co/t/the-state-of-types-in-elasticsearch-7/310146/2 "2022-08-17T12:28:49Z")

</div>

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