With the Java API I'm pretty sure you can get the query DSL from the toString() on SearchRequestBuilder.
Something like this might work for you: SearchRequestBuilder searchRequestBuilder = new SearchRequestBuilder(client); ... searchRequestBuilder.setQuery(queryBuilder.buildAsBytes()); logger.info("query: {}", searchRequestBuilder); HTH On Friday, January 31, 2014 2:12:22 PM UTC-5, coder wrote: > > Hi, > > I have following java code which query for search results. > > String script = "_score * (doc['po'].empty ? 1 : doc['po'].value == 0.0 ? > 1 : doc['po'].value)"; > QueryBuilder queryBuilder = QueryBuilders.customScoreQuery( > QueryBuilders.queryString(query) > .field("text",30) > .field("ad") > .field("st") > .field("cn") > .field("co") > > .defaultOperator(Operator.AND)).script(script); > > Can anyone tell me what will be the equivalent query dsl along with the > explain api ? > > I tried using this but it is not working: > > curl -XGET localhost:9200/acqindex/_search&pretty=true&explain=true -d '{ > "query":{ > "custom_score": { > "query": { > "query": "hotel in" > }, > "script" : "_score * doc['po'].value" > } > } > }' > > Thanks > > > > -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/b68af0ce-c964-41b7-ae17-0c82b17271d4%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.