# Springboot integration Elasticsearch @Filed fails

**URL:** https://discuss.elastic.co/t/springboot-integration-elasticsearch-filed-fails/345891
**Category:** Elasticsearch
**Created:** [October 27, 2023, 8:15am UTC](https://discuss.elastic.co/t/springboot-integration-elasticsearch-filed-fails/345891 "2023-10-27T08:15:02Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![wu\_wei](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wu_wei/32/126955_2.png) [@wu\_wei](https://discuss.elastic.co/u/wu_wei)
#### Post date: [October 27, 2023, 8:15am UTC](https://discuss.elastic.co/t/springboot-integration-elasticsearch-filed-fails/345891/1 "2023-10-27T08:15:02Z")

</div>

The springboot version is 2.3.12.RELEASE, the Elasticsearch client uses 7.6.2, and the corresponding spring data Elasticsearch is 4.0.9

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/d/b/db565e3470b9531a1326776e7620f5a774639ffc.jpeg)

Now when using the officially provided ElasticsearchRepository interface to save data, there is an ESInfraredOriginal class. This class has the @Document (indexName = "infrared-original") annotation, and each attribute has the @Field annotation.

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/6/8/68fc18f7b62890f7ac4fd1a7dc702d3d54f17b5b.png)

I used the controller to test and the index was created, but why is the type different? My annotation @field specifies type, why does it not take effect? Why are the types of Elasticsearch different?

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/4/c/4c8f25e142c6dedbbeda204ed3cabcd186d81805.png)

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/f/c/fcb9a3f16881442f457202383e7cb7d6ab68233b.png)

---

<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: [October 27, 2023, 9:48am UTC](https://discuss.elastic.co/t/springboot-integration-elasticsearch-filed-fails/345891/2 "2023-10-27T09:48:07Z")

</div>

Hey

Did you delete the index before restarting your code?

---

<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: [November 24, 2023, 9:48am UTC](https://discuss.elastic.co/t/springboot-integration-elasticsearch-filed-fails/345891/3 "2023-11-24T09:48:43Z")

</div>

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