# Is SearchRequestBuilder.setExtraSource/setSource broken in 1.0.0.Beta2?

**URL:** <https://discuss.elastic.co/t/is-searchrequestbuilder-setextrasource-setsource-broken-in-1-0-0-beta2/14903>\
**Category:** Elasticsearch\
**Created:** [December 17, 2013, 6:27am UTC](https://discuss.elastic.co/t/is-searchrequestbuilder-setextrasource-setsource-broken-in-1-0-0-beta2/14903 "2013-12-17T06:27:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ashwin\_Jayaprakash](https://avatars.discourse-cdn.com/v4/letter/a/b3f665/32.png) [@Ashwin\_Jayaprakash](https://discuss.elastic.co/u/Ashwin_Jayaprakash)\
**Post date:** [December 17, 2013, 6:27am UTC](https://discuss.elastic.co/t/is-searchrequestbuilder-setextrasource-setsource-broken-in-1-0-0-beta2/14903/1 "2013-12-17T06:27:10Z")

</div>

Hi, I was searching the internet trying to find the API to feed a JSON  
query string directly into SearchRequestBuilder. Then I learned that the  
setSource/setExtraSource should do the trick. I'm using 1.0.0.Beta2 and  
this does not seem to be working.

My JSON string which works if I use it via Curl/Sense Chrome plugin is:  
[http://localhost:9200/foo/\_search](http://localhost:9200/foo/_search)  
{ "query" : {"query\_string":{"query":"\*"}} }

The same string does not produce any results when I use:  
SearchRequestBuilder builder =  
client.prepareSearch().setIndices(indices).setExtraSource(query);

SearchRequestBuilder.toString() produces an empty "{}" JSON string.

Everything works when I use the explicit  
"builder.setQuery(QueryBuilders....)" methods. What am I doing wrong?

Thanks,  
Ashwin.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/6d04e513-fa3a-4e21-9cf9-d74f09924060%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/6d04e513-fa3a-4e21-9cf9-d74f09924060%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:00am UTC](https://discuss.elastic.co/t/is-searchrequestbuilder-setextrasource-setsource-broken-in-1-0-0-beta2/14903/2 "2017-07-06T02:00:45Z")

</div>


