How to do custom score queries in elastic search 0.9 through java api?


(John Chang) #1

How do I do a custom score query through the java client api?

I want to do what is described here, except do it through the java api:


Is this possible, or do I have to use the REST api to get this functionality?

I assume it is not the method sort(java.lang.String s) on org.elasticsearch.search.builder.SearchSourceBuilder, as that method has been there at least since 0.8, and my understanding is that custom score queries are new in 0.9.

Thanks.


(Shay Banon) #2

In your java code, you wrap the query that you execute with a
customScoreQuery (from the static factory QueryBuilders). In general,
everything that you have in the REST API is exposed in the Java API.

-shay.banon

On Tue, Aug 3, 2010 at 3:01 AM, John Chang jchangkihtest2@gmail.com wrote:

How do I do a custom score query through the java client api?

I want to do what is described here, except do it through the java api:
http://github.com/elasticsearch/elasticsearch/issues/220
Is this possible, or do I have to use the REST api to get this
functionality?

I assume it is not the method sort(java.lang.String s) on
org.elasticsearch.search.builder.SearchSourceBuilder, as that method has
been there at least since 0.8, and my understanding is that custom score
queries are new in 0.9.

Thanks.

View this message in context:
http://elasticsearch-users.115913.n3.nabble.com/How-to-do-custom-score-queries-in-elastic-search-0-9-through-java-api-tp1017635p1017635.html
Sent from the ElasticSearch Users mailing list archive at Nabble.com.


(system) #3