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


(Ashwin Jayaprakash) #1

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
{ "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.
To view this discussion on the web visit 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.


(system) #2