# I use elasticsearch in java ,and i get some questions that i can't understand

**URL:** https://discuss.elastic.co/t/i-use-elasticsearch-in-java-and-i-get-some-questions-that-i-cant-understand/244890
**Category:** Elasticsearch
**Created:** [August 13, 2020, 1:32pm UTC](https://discuss.elastic.co/t/i-use-elasticsearch-in-java-and-i-get-some-questions-that-i-cant-understand/244890 "2020-08-13T13:32:18Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![AnswerNo2](https://avatars.discourse-cdn.com/v4/letter/a/fbc32d/32.png) [@AnswerNo2](https://discuss.elastic.co/u/AnswerNo2)
#### Post date: [August 13, 2020, 1:32pm UTC](https://discuss.elastic.co/t/i-use-elasticsearch-in-java-and-i-get-some-questions-that-i-cant-understand/244890/1 "2020-08-13T13:32:18Z")

</div>

when i create a doc，i need use : IndexRequest indexRequest = new IndexRequest(String indexName); the question is :  
indexRequest .type(type) ,this method is deprecated, and what method can replace it ？ i want know!

 ![QQ截图20200813213142](https://us1.discourse-cdn.com/elastic/original/3X/8/d/8d75191f4731ae2007cc96d6e9309abffeeee66e.png)

---

<div class="post-metadata">

### Author: ![DavidTurner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/davidturner/32/22453_2.png) [@DavidTurner](https://discuss.elastic.co/u/DavidTurner)
#### Post date: [August 13, 2020, 2:15pm UTC](https://discuss.elastic.co/t/i-use-elasticsearch-in-java-and-i-get-some-questions-that-i-cant-understand/244890/2 "2020-08-13T14:15:22Z")

</div>

There is no replacement, indices only have one type so there is no longer any need to specify a type. See [removal of mapping types](https://www.elastic.co/guide/en/elasticsearch/reference/current/removal-of-types.html) for more information.

---

<div class="post-metadata">

### Author: ![AnswerNo2](https://avatars.discourse-cdn.com/v4/letter/a/fbc32d/32.png) [@AnswerNo2](https://discuss.elastic.co/u/AnswerNo2)
#### Post date: [August 14, 2020, 11:31am UTC](https://discuss.elastic.co/t/i-use-elasticsearch-in-java-and-i-get-some-questions-that-i-cant-understand/244890/3 "2020-08-14T11:31:52Z")

</div>

i see ， it means that a index just one default type? and just like mysql a database to a table?

---

<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 11, 2020, 11:32am UTC](https://discuss.elastic.co/t/i-use-elasticsearch-in-java-and-i-get-some-questions-that-i-cant-understand/244890/4 "2020-09-11T11:32:19Z")

</div>

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