# TypeMissingException

**URL:** <https://discuss.elastic.co/t/typemissingexception/4721>\
**Category:** Elasticsearch\
**Created:** [June 27, 2011, 8:08pm UTC](https://discuss.elastic.co/t/typemissingexception/4721 "2011-06-27T20:08:14Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jacorob](https://avatars.discourse-cdn.com/v4/letter/j/dec6dc/32.png) [@jacorob](https://discuss.elastic.co/u/jacorob)\
**Post date:** [June 27, 2011, 8:08pm UTC](https://discuss.elastic.co/t/typemissingexception/4721/1 "2011-06-27T20:08:14Z")

</div>

I'm running an embedded 0.16.2 on win7 and Sun 1.6.0\_23 using default  
storage mechanism. I have it set to use 5 shards with 0 replicas. The index  
is created on startup of my application and all index updates are  
synchronous (in that I I explicitly wait for the refresh after every index  
operation..yes.. i know this is a performance sapper). I also use BulkIndex  
operations and a default dynamic template/dynamic mappings so expect a new  
type with a default mapping to be created each time a new type is  
encountered.

I'm trying to understand a 'TypeMissingException' that I occasionally (but  
not always) encounter when starting up my application (which creates the  
index and then initializes some data into the index). I index a document and  
then turn around and immediately try to search for it. Looking at the  
response elastic search provides for my search the SearchResponse shows a  
total hit size of 1 (response.getHits().getTotalHits()). However, when I try  
to actually get the SearchHit (response.getHits().getHits().getAt(0)) I get  
an IndexOutOfBounds error (the searchHit array is empty). So even though the  
response says there is a search hit, it doesn't actually return any hits

When I look at the SearchResponse, there is a shard failure with the  
exception:  
TypeMissingException[[entity\_index\_] type[abbstrctsapdrsbfbdswvotoqtdpdwer]  
missing: failed to find type loaded for doc  
[dbcvfdpedbaqrfcfafftbfderetuvqns]]

My intepretation is that this means the shard finds the doc  
'dbcvfdpedbaqrfcfafftbfderetuvqns' within the shard, but does not find the  
'type' specified in the doc ('abbstrctsapdrsbfbdswvotoqtdpdwer'). How could  
this happen since the type should automatically be created?

Also, if I wait for a little bit and rerun the exact same query (have a  
breakpoint set at where this error occurrs) i get a result back without any  
shard failures which seems to indicate a race condition, but then I  
explicitly wait for refresh on all my index operations. I'm obviously  
missing something so any help/pointers are appreciated.

Bob

PS - I thought this may be related to  
[https://github.com/elasticsearch/elasticsearch/issues/931](https://github.com/elasticsearch/elasticsearch/issues/931) (fixed in 0.16.2),  
but I explicitly create the index on startup, whereas this issue talked  
about the index automatically being created when the first document is  
received.

---

<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:** [June 27, 2011, 9:20pm UTC](https://discuss.elastic.co/t/typemissingexception/4721/2 "2011-06-27T21:20:09Z")

</div>

Hi,

If you create the index, then all the type information should be broadcasted and parsed on all nodes. The problem you see is that the type is not (yet?) there in the mapping data structure on that node. Is there a chance for a simple recreation (even if it fails every once in a while)? Also, if you have the bandwidth, can you see if it happens with master?

-shay.banon

On Monday, June 27, 2011 at 11:08 PM, Bob Jacoby wrote:

> I'm running an embedded 0.16.2 on win7 and Sun 1.6.0\_23 using default storage mechanism. I have it set to use 5 shards with 0 replicas. The index is created on startup of my application and all index updates are synchronous (in that I I explicitly wait for the refresh after every index operation..yes.. i know this is a performance sapper). I also use BulkIndex operations and a default dynamic template/dynamic mappings so expect a new type with a default mapping to be created each time a new type is encountered.
> 
> I'm trying to understand a 'TypeMissingException' that I occasionally (but not always) encounter when starting up my application (which creates the index and then initializes some data into the index). I index a document and then turn around and immediately try to search for it. Looking at the response Elasticsearch provides for my search the SearchResponse shows a total hit size of 1 (response.getHits().getTotalHits()). However, when I try to actually get the SearchHit (response.getHits().getHits().getAt(0)) I get an IndexOutOfBounds error (the searchHit array is empty). So even though the response says there is a search hit, it doesn't actually return any hits
> 
> When I look at the SearchResponse, there is a shard failure with the exception:  
> TypeMissingException[[entity\_index\_] type[abbstrctsapdrsbfbdswvotoqtdpdwer] missing: failed to find type loaded for doc [dbcvfdpedbaqrfcfafftbfderetuvqns]]
> 
> My intepretation is that this means the shard finds the doc 'dbcvfdpedbaqrfcfafftbfderetuvqns' within the shard, but does not find the 'type' specified in the doc ('abbstrctsapdrsbfbdswvotoqtdpdwer'). How could this happen since the type should automatically be created?
> 
> Also, if I wait for a little bit and rerun the exact same query (have a breakpoint set at where this error occurrs) i get a result back without any shard failures which seems to indicate a race condition, but then I explicitly wait for refresh on all my index operations. I'm obviously missing something so any help/pointers are appreciated.
> 
> Bob
> 
> PS - I thought this may be related to [Deleting and recreating a new index with dynamic mapping can cause type failures · Issue #931 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/931) (fixed in 0.16.2), but I explicitly create the index on startup, whereas this issue talked about the index automatically being created when the first document is received.

---

<div class="post-metadata">

**Author:** ![jacorob](https://avatars.discourse-cdn.com/v4/letter/j/dec6dc/32.png) [@jacorob](https://discuss.elastic.co/u/jacorob)\
**Post date:** [June 28, 2011, 8:42pm UTC](https://discuss.elastic.co/t/typemissingexception/4721/3 "2011-06-28T20:42:18Z")

</div>

Hi, Shay. I tried with master and encountered the same error running my  
single embedded node.

shard [_na], reason [TypeMissingException[[entity\_index_]  
type[abbstrctsapdrsbfbdswvotoqtdpdwer] missing: failed to find type loaded  
for doc [refbwcnuwqvqrqwbbaqavuwefveebncb]]]

I'll try and put together a recreation.

Bob

On Mon, Jun 27, 2011 at 4:20 PM, Shay Banon [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com)wrote:

> Hi,
> 
> If you create the index, then all the type information should be  
> broadcasted and parsed on all nodes. The problem you see is that the type is  
> not (yet?) there in the mapping data structure on that node. Is there a  
> chance for a simple recreation (even if it fails every once in a while)?  
> Also, if you have the bandwidth, can you see if it happens with master?
> 
> -shay.banon
> 
> On Monday, June 27, 2011 at 11:08 PM, Bob Jacoby wrote:
> 
> I'm running an embedded 0.16.2 on win7 and Sun 1.6.0\_23 using default  
> storage mechanism. I have it set to use 5 shards with 0 replicas. The index  
> is created on startup of my application and all index updates are  
> synchronous (in that I I explicitly wait for the refresh after every index  
> operation..yes.. i know this is a performance sapper). I also use BulkIndex  
> operations and a default dynamic template/dynamic mappings so expect a new  
> type with a default mapping to be created each time a new type is  
> encountered.
> 
> I'm trying to understand a 'TypeMissingException' that I occasionally (but  
> not always) encounter when starting up my application (which creates the  
> index and then initializes some data into the index). I index a document and  
> then turn around and immediately try to search for it. Looking at the  
> response Elasticsearch provides for my search the SearchResponse shows a  
> total hit size of 1 (response.getHits().getTotalHits()). However, when I try  
> to actually get the SearchHit (response.getHits().getHits().getAt(0)) I get  
> an IndexOutOfBounds error (the searchHit array is empty). So even though the  
> response says there is a search hit, it doesn't actually return any hits
> 
> When I look at the SearchResponse, there is a shard failure with the  
> exception:  
> TypeMissingException[[entity\_index\_] type[abbstrctsapdrsbfbdswvotoqtdpdwer]  
> missing: failed to find type loaded for doc  
> [dbcvfdpedbaqrfcfafftbfderetuvqns]]
> 
> My intepretation is that this means the shard finds the doc  
> 'dbcvfdpedbaqrfcfafftbfderetuvqns' within the shard, but does not find the  
> 'type' specified in the doc ('abbstrctsapdrsbfbdswvotoqtdpdwer'). How could  
> this happen since the type should automatically be created?
> 
> Also, if I wait for a little bit and rerun the exact same query (have a  
> breakpoint set at where this error occurrs) i get a result back without any  
> shard failures which seems to indicate a race condition, but then I  
> explicitly wait for refresh on all my index operations. I'm obviously  
> missing something so any help/pointers are appreciated.
> 
> Bob
> 
> PS - I thought this may be related to  
> [Deleting and recreating a new index with dynamic mapping can cause type failures · Issue #931 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/931) (fixed in  
> 0.16.2), but I explicitly create the index on startup, whereas this issue  
> talked about the index automatically being created when the first document  
> is received.

---

<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:02am UTC](https://discuss.elastic.co/t/typemissingexception/4721/4 "2017-07-06T04:02:21Z")

</div>


