# Inconsistent ElasticSearchIllegalStateException

**URL:** <https://discuss.elastic.co/t/inconsistent-elasticsearchillegalstateexception/4278>\
**Category:** Elasticsearch\
**Created:** [April 22, 2011, 5:18pm UTC](https://discuss.elastic.co/t/inconsistent-elasticsearchillegalstateexception/4278 "2011-04-22T17:18:28Z")\
**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:** [April 22, 2011, 5:18pm UTC](https://discuss.elastic.co/t/inconsistent-elasticsearchillegalstateexception/4278/1 "2011-04-22T17:18:28Z")

</div>

Every once in a while I get an error from one of my test cases that I  
was hoping someone could shed some light on. I'm sending numerous  
index requests to an embedded es 0.15.2 implementation during my test  
(while also pulling info out).

Every now and then the source of the index request received by the es  
node to index is prefixed by something like:  
🙂  
ú‹query\_binaryý»{"term":  
{"\_entityGuid":"wqedaccdneqrrdurwnsvarafteawrfqb"}}û

The full index request is therefore:  
🙂  
ú‹query\_binaryý»{"term":  
{"\_entityGuid":"wqedaccdneqrrdurwnsvarafteawrfqb"}}  
û{"\_entityGuid":"cucbvbswsddrraveabcpsvawtwwsbtru","...}

where everything after the prefix appears to be one of my valid index  
requests.

(i extracted the "request" source in  
org.elasticsearch.index.mapper.xcontent.ObjectMapper serializeValue  
method)

When ES tries to index this request it blows up with:  
org.elasticsearch.ElasticSearchIllegalStateException: Can't handle  
serializing a dynamic type with content token [VALUE\_EMBEDDED\_OBJECT]  
and field name [query\_binary]  
at  
org.elasticsearch.index.mapper.xcontent.ObjectMapper.serializeValue(ObjectMapper.java:  
519)  
...  
The full error stack trace available at [https://gist.github.com/937086](https://gist.github.com/937086).

I do send term queries on that field though so it's not random data,  
though it gets added to my index request source in apparent random  
fashion. I don't know if this is a potential threading issue or what.  
I use the same client for all my requests (queries and index  
requests).

Any thoughts on where to begin looking?

Thanks,  
Bob

---

<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:** [April 22, 2011, 5:36pm UTC](https://discuss.elastic.co/t/inconsistent-elasticsearchillegalstateexception/4278/2 "2011-04-22T17:36:24Z")

</div>

I don't understand what you are doing based on your example. Create a simple test case and we can have a look.  
On Friday, April 22, 2011 at 8:18 PM, Bob wrote:

> Every once in a while I get an error from one of my test cases that I  
> was hoping someone could shed some light on. I'm sending numerous  
> index requests to an embedded es 0.15.2 implementation during my test  
> (while also pulling info out).
> 
> Every now and then the source of the index request received by the es  
> node to index is prefixed by something like:  
> 🙂  
> Ãºâ¹query\_binaryÃ½Â»{"term":  
> {"\_entityGuid":"wqedaccdneqrrdurwnsvarafteawrfqb"}}Ã»
> 
> The full index request is therefore:  
> 🙂  
> Ãºâ¹query\_binaryÃ½Â»{"term":  
> {"\_entityGuid":"wqedaccdneqrrdurwnsvarafteawrfqb"}}  
> Ã»{"\_entityGuid":"cucbvbswsddrraveabcpsvawtwwsbtru","...}
> 
> where everything after the prefix appears to be one of my valid index  
> requests.
> 
> (i extracted the "request" source in  
> org.elasticsearch.index.mapper.xcontent.ObjectMapper serializeValue  
> method)
> 
> When ES tries to index this request it blows up with:  
> org.elasticsearch.ElasticSearchIllegalStateException: Can't handle  
> serializing a dynamic type with content token [VALUE\_EMBEDDED\_OBJECT]  
> and field name [query\_binary]  
> at  
> org.elasticsearch.index.mapper.xcontent.ObjectMapper.serializeValue(ObjectMapper.java:  
> 519)  
> ...  
> The full error stack trace available at [ElasticSearchIllegalStateException · GitHub](https://gist.github.com/937086).
> 
> I do send term queries on that field though so it's not random data,  
> though it gets added to my index request source in apparent random  
> fashion. I don't know if this is a potential threading issue or what.  
> I use the same client for all my requests (queries and index  
> requests).
> 
> Any thoughts on where to begin looking?
> 
> Thanks,  
> Bob

---

<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:** [April 27, 2011, 1:23pm UTC](https://discuss.elastic.co/t/inconsistent-elasticsearchillegalstateexception/4278/3 "2011-04-27T13:23:13Z")

</div>

Thanks, Shay. Thinking through it some more I thought maybe it was  
similar to an issue I had earlier with the same byte buffer being used  
underneath the covers of my IndexRequests. I switched from using a  
jsonBuilder to safeJsonBuilder when creating my bulk index requests  
and it seems to have solved the problem (at least I haven't seen it  
since). I don't exactly see where I'm using it incorrectly, but I must  
be somewhere...

Thanks,  
Bob

On Apr 22, 12:36 pm, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:

> I don't understand what you are doing based on your example. Create a simple test case and we can have a look.
> 
> On Friday, April 22, 2011 at 8:18 PM, Bob wrote:
> 
> > Every once in a while I get an error from one of my test cases that I  
> > was hoping someone could shed some light on. I'm sending numerous  
> > index requests to an embedded es 0.15.2 implementation during my test  
> > (while also pulling info out).
> 
> > Every now and then the source of the index request received by the es  
> > node to index is prefixed by something like:  
> > 🙂  
> > ú‹query\_binaryý»{"term":  
> > {"\_entityGuid":"wqedaccdneqrrdurwnsvarafteawrfqb"}}û
> 
> > The full index request is therefore:  
> > 🙂  
> > ú‹query\_binaryý»{"term":  
> > {"\_entityGuid":"wqedaccdneqrrdurwnsvarafteawrfqb"}}  
> > û{"\_entityGuid":"cucbvbswsddrraveabcpsvawtwwsbtru","...}
> 
> > where everything after the prefix appears to be one of my valid index  
> > requests.
> 
> > (i extracted the "request" source in  
> > org.elasticsearch.index.mapper.xcontent.ObjectMapper serializeValue  
> > method)
> 
> > When ES tries to index this request it blows up with:  
> > org.elasticsearch.ElasticSearchIllegalStateException: Can't handle  
> > serializing a dynamic type with content token [VALUE\_EMBEDDED\_OBJECT]  
> > and field name [query\_binary]  
> > at  
> > org.elasticsearch.index.mapper.xcontent.ObjectMapper.serializeValue(ObjectM apper.java:  
> > 519)  
> > ...  
> > The full error stack trace available athttps://gist.github.com/937086.
> 
> > I do send term queries on that field though so it's not random data,  
> > though it gets added to my index request source in apparent random  
> > fashion. I don't know if this is a potential threading issue or what.  
> > I use the same client for all my requests (queries and index  
> > requests).
> 
> > Any thoughts on where to begin looking?
> 
> > Thanks,  
> > Bob

---

<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:07am UTC](https://discuss.elastic.co/t/inconsistent-elasticsearchillegalstateexception/4278/4 "2017-07-06T04:07:33Z")

</div>

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


