# 0.15.1 Index creation / Put mappings race condition

**URL:** <https://discuss.elastic.co/t/0-15-1-index-creation-put-mappings-race-condition/4008>\
**Category:** Elasticsearch\
**Created:** [March 2, 2011, 12:57am UTC](https://discuss.elastic.co/t/0-15-1-index-creation-put-mappings-race-condition/4008 "2011-03-02T00:57:26Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ppearcy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ppearcy/32/980_2.png) [@ppearcy](https://discuss.elastic.co/u/ppearcy)\
**Post date:** [March 2, 2011, 12:57am UTC](https://discuss.elastic.co/t/0-15-1-index-creation-put-mappings-race-condition/4008/1 "2011-03-02T00:57:26Z")

</div>

Hey,  
Just moved to 0.15.1 from 0.14.2. When my app starts with a fresh  
cluster it does the following:  
for index : indexes  
Create index  
Apply mappings

I am getting index not found errors when applying the mappings to a  
just created index. After adding a 200ms sleep between the create and  
put mappings, everything seems fine.

Thanks,  
Paul

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [March 2, 2011, 1:37am UTC](https://discuss.elastic.co/t/0-15-1-index-creation-put-mappings-race-condition/4008/2 "2011-03-02T01:37:12Z")

</div>

Can you gist the exception message? Strange that it happens (I assume you wait for the create index request to happen?). Its usually better to have the mappings provided as part of the index request (more atomic), but what you do shoudl still work...  
On Wednesday, March 2, 2011 at 2:57 AM, Paul wrote:

> Hey,  
> Just moved to 0.15.1 from 0.14.2. When my app starts with a fresh  
> cluster it does the following:  
> for index : indexes  
> Create index  
> Apply mappings
> 
> I am getting index not found errors when applying the mappings to a  
> just created index. After adding a 200ms sleep between the create and  
> put mappings, everything seems fine.
> 
> Thanks,  
> Paul

---

<div class="post-metadata">

**Author:** ![ppearcy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ppearcy/32/980_2.png) [@ppearcy](https://discuss.elastic.co/u/ppearcy)\
**Post date:** [March 3, 2011, 8:33pm UTC](https://discuss.elastic.co/t/0-15-1-index-creation-put-mappings-race-condition/4008/3 "2011-03-03T20:33:20Z")

</div>

The exception looks like this:  
org.elasticsearch.indices.IndexMissingException: [idol-markithub]  
missing

No stack trace with it.

What does the java code look like to create the index and apply the  
mappings at the same time?

Thanks,  
Paul

On Mar 1, 6:37 pm, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:

> Can you gist the exception message? Strange that it happens (I assume you wait for the create index request to happen?). Its usually better to have the mappings provided as part of the index request (more atomic), but what you do shoudl still work...
> 
> On Wednesday, March 2, 2011 at 2:57 AM, Paul wrote:
> 
> > Hey,  
> > Just moved to 0.15.1 from 0.14.2. When my app starts with a fresh  
> > cluster it does the following:  
> > for index : indexes  
> > Create index  
> > Apply mappings
> 
> > I am getting index not found errors when applying the mappings to a  
> > just created index. After adding a 200ms sleep between the create and  
> > put mappings, everything seems fine.
> 
> > Thanks,  
> > Paul

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [March 4, 2011, 4:12pm UTC](https://discuss.elastic.co/t/0-15-1-index-creation-put-mappings-race-condition/4008/4 "2011-03-04T16:12:43Z")

</div>

The create index API allows you to add mappings to it.  
On Thursday, March 3, 2011 at 10:33 PM, Paul wrote:

> The exception looks like this:  
> org.elasticsearch.indices.IndexMissingException: [idol-markithub]  
> missing
> 
> No stack trace with it.
> 
> What does the java code look like to create the index and apply the  
> mappings at the same time?
> 
> Thanks,  
> Paul
> 
> On Mar 1, 6:37 pm, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:
> 
> > Can you gist the exception message? Strange that it happens (I assume you wait for the create index request to happen?). Its usually better to have the mappings provided as part of the index request (more atomic), but what you do shoudl still work...
> > 
> > On Wednesday, March 2, 2011 at 2:57 AM, Paul wrote:
> > 
> > > Hey,  
> > > Just moved to 0.15.1 from 0.14.2. When my app starts with a fresh  
> > > cluster it does the following:  
> > > for index : indexes  
> > > Create index  
> > > Apply mappings
> > 
> > > I am getting index not found errors when applying the mappings to a  
> > > just created index. After adding a 200ms sleep between the create and  
> > > put mappings, everything seems fine.
> > 
> > > Thanks,  
> > > Paul

---

<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:** [July 6, 2017, 4:10am UTC](https://discuss.elastic.co/t/0-15-1-index-creation-put-mappings-race-condition/4008/5 "2017-07-06T04:10:52Z")

</div>

Closed on July 6, 2017, 4:10am UTC


