# Search that works with curl but throw SearchPhaseExecutionException when using Java

**URL:** <https://discuss.elastic.co/t/search-that-works-with-curl-but-throw-searchphaseexecutionexception-when-using-java/4181>\
**Category:** Elasticsearch\
**Created:** [April 1, 2011, 8:50am UTC](https://discuss.elastic.co/t/search-that-works-with-curl-but-throw-searchphaseexecutionexception-when-using-java/4181 "2011-04-01T08:50:30Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![dpilato](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dpilato/32/2449_2.png) [@dpilato](https://discuss.elastic.co/u/dpilato)\
**Post date:** [April 1, 2011, 8:50am UTC](https://discuss.elastic.co/t/search-that-works-with-curl-but-throw-searchphaseexecutionexception-when-using-java/4181/1 "2011-04-01T08:50:30Z")

</div>

Hi there,

I have some trouble while playing with ES.

I push an entity (a bit complex) to a clean ES :

> <https://gist.github.com/dadoonet/897892>
>
> There are more than three files. show original

It works.

Then, I search it with curl :

> <https://gist.github.com/dadoonet/897892>
>
> There are more than three files. show original

It works. I find my document.

Then I do it again with Java :

> <https://gist.github.com/dadoonet/897892>
>
> There are more than three files. show original

It fails with a SearchPhaseExecutionException. Here is the stacktrace :

> <https://gist.github.com/dadoonet/897892>
>
> There are more than three files. show original

When I search with a less deeper property, java search works (and curl also  
! ;-)).

So, is there anything wrong with my document mapping ? I'm using the default  
mapping provided by ES.

Perhaps, the way I wrote my java search is wrong.

Any help will be appreciated.

Cheers,

David.

Full gist here : [https://gist.github.com/897892](https://gist.github.com/897892)

---

<div class="post-metadata">

**Author:** ![dpilato](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dpilato/32/2449_2.png) [@dpilato](https://discuss.elastic.co/u/dpilato)\
**Post date:** [April 5, 2011, 6:17pm UTC](https://discuss.elastic.co/t/search-that-works-with-curl-but-throw-searchphaseexecutionexception-when-using-java/4181/2 "2011-04-05T18:17:23Z")

</div>

Hi there,

Any idea about this problem ?  
Do you want me to open a bug about it ?

Thanks,  
David

---

<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 6, 2011, 9:46am UTC](https://discuss.elastic.co/t/search-that-works-with-curl-but-throw-searchphaseexecutionexception-when-using-java/4181/3 "2011-04-06T09:46:36Z")

</div>

Heya,

Narrowed it down to a bug in the smile format used (optimized json). You can hack around it by forcing ES to use Json by setting Requests.CONTENT\_TYPE to XContentType.JSON (its a static value).

I will follow up with jackson and report back.  
On Friday, April 1, 2011 at 11:50 AM, David Pilato wrote:

> Hi there,
> 
> I have some trouble while playing with ES.
> 
> I push an entity (a bit complex) to a clean ES :  
> [Exception when searching docs in ES with Java · GitHub](https://gist.github.com/897892#file_index.sh)
> 
> It works.
> 
> Then, I search it with curl :  
> [Exception when searching docs in ES with Java · GitHub](https://gist.github.com/897892#file_search.sh)
> 
> It works. I find my document.
> 
> Then I do it again with Java :  
> [Exception when searching docs in ES with Java · GitHub](https://gist.github.com/897892#file_es_test_case.java)
> 
> It fails with a SearchPhaseExecutionException. Here is the stacktrace : [Exception when searching docs in ES with Java · GitHub](https://gist.github.com/897892#file_stack_trace.txt)
> 
> When I search with a less deeper property, java search works (and curl also ! ;-)).
> 
> So, is there anything wrong with my document mapping ? Iâm using the default mapping provided by ES.  
> Perhaps, the way I wrote my java search is wrongâ¦
> 
> Any help will be appreciated.  
> Cheers,  
> David.
> 
> Full gist here : [Exception when searching docs in ES with Java · GitHub](https://gist.github.com/897892)

---

<div class="post-metadata">

**Author:** ![dpilato](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dpilato/32/2449_2.png) [@dpilato](https://discuss.elastic.co/u/dpilato)\
**Post date:** [April 11, 2011, 10:49am UTC](https://discuss.elastic.co/t/search-that-works-with-curl-but-throw-searchphaseexecutionexception-when-using-java/4181/4 "2011-04-11T10:49:59Z")

</div>

Just to close this thread (in case of somebody find the same issue), Kimchy opened a JIRA on this : [JACKSON-552](http://jira.codehaus.org/browse/JACKSON-552).

It will be in the next 1.7.6 release of Jackson and perhaps in the next 0.16.0 release of Elastic.

Thanks for your help. The hack works fine...

---

<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:08am UTC](https://discuss.elastic.co/t/search-that-works-with-curl-but-throw-searchphaseexecutionexception-when-using-java/4181/5 "2017-07-06T04:08:37Z")

</div>


