# co.elastic.clients.elasticsearch.\_types.ElasticsearchException: \[es/indices.create\] failed: \[resource\_already\_exists\_exception\] index \[\[test1111/OvwpReOdTNa-44HKedMUrw\]\]already exists

**URL:** <https://discuss.elastic.co/t/co-elastic-clients-elasticsearch-types-elasticsearchexception-es-indices-create-failed-resource-already-exists-exception-index-test1111-ovwpreodtna-44hkedmurw-already-exists/328321>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [March 23, 2023, 8:10am UTC](https://discuss.elastic.co/t/co-elastic-clients-elasticsearch-types-elasticsearchexception-es-indices-create-failed-resource-already-exists-exception-index-test1111-ovwpreodtna-44hkedmurw-already-exists/328321 "2023-03-23T08:10:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![chinaman](https://avatars.discourse-cdn.com/v4/letter/c/b5e925/32.png) [@chinaman](https://discuss.elastic.co/u/chinaman)\
**Post date:** [March 23, 2023, 8:10am UTC](https://discuss.elastic.co/t/co-elastic-clients-elasticsearch-types-elasticsearchexception-es-indices-create-failed-resource-already-exists-exception-index-test1111-ovwpreodtna-44hkedmurw-already-exists/328321/1 "2023-03-23T08:10:04Z")

</div>

Create index use elasticsearchClient.indices() , Executed Exception:co.elastic.clients.elasticsearch.\_types.ElasticsearchException: [es/indices.create] failed:[resource\_already\_exists\_exception] index [test12345/OvwpReOdTNa-44HKedMUrw] already exists

Elasticsearch 7.17.3 ,  
Technology stack use Elasticsearch Java Api Client

Code:  
Map\<String, Property\> propertyMap = new HashMap\<\>();  
propertyMap.put("id", new Property(new LongNumberProperty.Builder().index(true).store(true).build()));  
propertyMap.put("name", new Property(new TextProperty.Builder().index(true).analyzer("ik\_max\_word").store(true).build()));  
CreateIndexResponse response = elasticsearchClient.indices().create(x -\> x  
.index(indexName)  
.settings(f -\> f.numberOfReplicas("1").numberOfShards("2"))  
.mappings(m -\> {  
m.properties(maps);  
return m;  
})  
);

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [March 23, 2023, 8:25am UTC](https://discuss.elastic.co/t/co-elastic-clients-elasticsearch-types-elasticsearchexception-es-indices-create-failed-resource-already-exists-exception-index-test1111-ovwpreodtna-44hkedmurw-already-exists/328321/2 "2023-03-23T08:25:57Z")

</div>

Welcome to our community! 😃

It looks like that index already exists, so it cannot create it again.

---

<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:** [April 20, 2023, 8:26am UTC](https://discuss.elastic.co/t/co-elastic-clients-elasticsearch-types-elasticsearchexception-es-indices-create-failed-resource-already-exists-exception-index-test1111-ovwpreodtna-44hkedmurw-already-exists/328321/3 "2023-04-20T08:26:18Z")

</div>

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