# New Type not getting created in Elasticsearch

**URL:** <https://discuss.elastic.co/t/new-type-not-getting-created-in-elasticsearch/109306>\
**Category:** Elasticsearch\
**Created:** [November 28, 2017, 5:00am UTC](https://discuss.elastic.co/t/new-type-not-getting-created-in-elasticsearch/109306 "2017-11-28T05:00:25Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![vidyapati](https://avatars.discourse-cdn.com/v4/letter/v/8c91f0/32.png) [@vidyapati](https://discuss.elastic.co/u/vidyapati)\
**Post date:** [November 28, 2017, 5:00am UTC](https://discuss.elastic.co/t/new-type-not-getting-created-in-elasticsearch/109306/1 "2017-11-28T05:00:25Z")

</div>

I am trying to create 3 elasticsearch type from code in an Index. One type is created successfully. Add data come in ES. But second type is not getting created. I am using spring elasticsearch data to create the data in ES.

This is below logs in ES. I can see the mapping for first Type , but 2nd Type I cant see mapping in ES.  
When I debug the code , the statement is executed successfully

^C[2017-11-28 09:47:44,028][INFO][node] [Human Robot] stopping ...  
[2017-11-28 09:47:44,135][INFO][node] [Human Robot] stopped  
[2017-11-28 09:47:44,135][INFO][node] [Human Robot] closing ...  
[2017-11-28 09:47:44,154][INFO][node] [Human Robot] closed  
BANL141bbeaff:bin vpati$ elasticsearch  
[2017-11-28 09:47:47,032][INFO][node] [Destroyer] version[2.4.6], pid[10955], build[5376dca/2017-07-18T12:17:44Z]  
[2017-11-28 09:47:47,033][INFO][node] [Destroyer] initializing ...  
[2017-11-28 09:47:47,537][INFO][plugins] [Destroyer] modules [reindex, lang-expression, lang-groovy], plugins [], sites []  
[2017-11-28 09:47:47,589][INFO][env] [Destroyer] using [1] data paths, mounts [[/ (/dev/disk1)]], net usable\_space [247.1gb], net total\_space [464.6gb], spins? [unknown], types [hfs]  
[2017-11-28 09:47:47,589][INFO][env] [Destroyer] heap size [989.8mb], compressed ordinary object pointers [true]  
[2017-11-28 09:47:47,589][WARN][env] [Destroyer] max file descriptors [10240] for elasticsearch process likely too low, consider increasing to at least [65536]  
[2017-11-28 09:47:49,089][INFO][node] [Destroyer] initialized  
[2017-11-28 09:47:49,089][INFO][node] [Destroyer] starting ...  
[2017-11-28 09:47:49,160][INFO][transport] [Destroyer] publish\_address {127.0.0.1:9300}, bound\_addresses {[fe80::1]:9300}, {[::1]:9300}, {127.0.0.1:9300}  
[2017-11-28 09:47:49,163][INFO][discovery] [Destroyer] elasticsearch/L-5qohSRRCqjy8wgp46J\_Q  
[2017-11-28 09:47:52,197][INFO][cluster.service] [Destroyer] new\_master {Destroyer}{L-5qohSRRCqjy8wgp46J\_Q}{127.0.0.1}{127.0.0.1:9300}, reason: zen-disco-join(elected\_as\_master, [0] joins received)  
[2017-11-28 09:47:52,211][INFO][http] [Destroyer] publish\_address {127.0.0.1:9200}, bound\_addresses {[fe80::1]:9200}, {[::1]:9200}, {127.0.0.1:9200}  
[2017-11-28 09:47:52,211][INFO][node] [Destroyer] started  
[2017-11-28 09:47:52,247][INFO][gateway] [Destroyer] recovered [1] indices into cluster\_state  
[2017-11-28 09:47:52,524][INFO][cluster.routing.allocation] [Destroyer] Cluster health status changed from [RED] to [YELLOW] (reason: [shards started [[asset\_attributor][1]] ...]).  
[2017-11-28 09:55:07,230][INFO][cluster.metadata] [Destroyer] [asset\_attributor] create\_mapping [snow\_asset]  
[2017-11-28 09:55:07,272][INFO][cluster.metadata] [Destroyer] [asset\_attributor] create\_mapping [host\_app]  
[2017-11-28 09:55:07,290][INFO][cluster.metadata] [Destroyer] [asset\_attributor] create\_mapping [ip\_app]  
[2017-11-28 09:55:45,703][INFO][cluster.metadata] [Destroyer] [asset\_attributor] update\_mapping [snow\_asset]  
[2017-11-28 09:57:44,115][INFO][cluster.metadata] [Destroyer] [asset\_attributor] update\_mapping [snow\_asset]

---

<div class="post-metadata">

**Author:** ![mujtabahussain](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mujtabahussain/32/17514_2.png) [@mujtabahussain](https://discuss.elastic.co/u/mujtabahussain)\
**Post date:** [November 28, 2017, 5:04am UTC](https://discuss.elastic.co/t/new-type-not-getting-created-in-elasticsearch/109306/2 "2017-11-28T05:04:13Z")

</div>

> [@vidyapati](#):
>
> When I debug the code , the statement is executed successfully

Could you please clarify the above statement? How did you debug? When you say executed successfully, do you mean that you were able to create all three types of mappings?

---

<div class="post-metadata">

**Author:** ![vidyapati](https://avatars.discourse-cdn.com/v4/letter/v/8c91f0/32.png) [@vidyapati](https://discuss.elastic.co/u/vidyapati)\
**Post date:** [November 28, 2017, 5:05am UTC](https://discuss.elastic.co/t/new-type-not-getting-created-in-elasticsearch/109306/3 "2017-11-28T05:05:48Z")

</div>

In eclipse I did the code debugging. I see "esl.saveNetgenieData(doc);" is executed every time. But I cant see Type and Data in index.

for (Map\<String, String\> data : netgenieCertData) {  
NetgenieDocument doc = new NetgenieDocument();  
doc.setCnameFrom(data.get("CNAME\_FROM"));  
doc.setCnameTo(data.get("CNAME\_TO"));  
doc.setOriginHostname(data.get("ORIGIN\_HOSTNAME"));  
doc.setOriginName(data.get("ORIGIN\_NAME"));  
try {  
esl.saveNetgenieData(doc);  
} catch (Exception ex) {  
ex.printStackTrace();  
}  
}

My document defination

@Document(indexName = "asset\_attributor", type = "netgenie2")

public class NetgenieDocument {

My ES Repository for above document

public interface NetgenieRepository extends ElasticsearchRepository\<NetgenieDocument, String\> {

}

---

<div class="post-metadata">

**Author:** ![mujtabahussain](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mujtabahussain/32/17514_2.png) [@mujtabahussain](https://discuss.elastic.co/u/mujtabahussain)\
**Post date:** [November 28, 2017, 5:14am UTC](https://discuss.elastic.co/t/new-type-not-getting-created-in-elasticsearch/109306/4 "2017-11-28T05:14:41Z")

</div>

What happens when you try and create the mappings via the REST API as shown [here](https://www.elastic.co/guide/en/elasticsearch/reference/2.4/indices-put-mapping.html) ?

---

<div class="post-metadata">

**Author:** ![vidyapati](https://avatars.discourse-cdn.com/v4/letter/v/8c91f0/32.png) [@vidyapati](https://discuss.elastic.co/u/vidyapati)\
**Post date:** [November 28, 2017, 5:16am UTC](https://discuss.elastic.co/t/new-type-not-getting-created-in-elasticsearch/109306/5 "2017-11-28T05:16:07Z")

</div>

Found the issue , its multi module application. In the 2nd Module ,properties file , i missed to add the property for ES.  
After that problem is solved.

spring.data.elasticsearch.cluster-name=elasticsearch  
spring.data.elasticsearch.cluster-nodes=127.0.0.1:9300  
spring.data.elasticsearch.local=false  
spring.data.elasticsearch.repositories.enabled=true

---

<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:** [December 26, 2017, 5:16am UTC](https://discuss.elastic.co/t/new-type-not-getting-created-in-elasticsearch/109306/6 "2017-12-26T05:16:26Z")

</div>

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