Java API - boost field on query

It's not clear to me how I can boost a specific field on the query
using the Java API. Basically, I'd like to do a query string search
across all fields and boost one of the fields so that if the search
string is found in that field, those documents will be ranked higher.

Is this possible using the Java API?

Thanks.

Mike

Few things:

  1. You can define boost at index time for field, when you search on the _all field, if there is a match for that field content, it will be boosted.

  2. You can use the query_string and provide the list of fields you wish to search on, each with different boost levels (QueryStringBuilder#field(String field, float boost).

A note, that I keep repeating and its in the docs, not sure why people keep missing it. The REST API is built on top of the Java API. There is no way to have something exposed in REST that is not exposed (in some way) using the Java API.
On Thursday, March 24, 2011 at 10:53 PM, Mike Brocious wrote:

It's not clear to me how I can boost a specific field on the query
using the Java API. Basically, I'd like to do a query string search
across all fields and boost one of the fields so that if the search
string is found in that field, those documents will be ranked higher.

Is this possible using the Java API?

Thanks.

Mike

Thanks, Shay. Appreciate your patience with us as we come up to speed
on ES.

I found the boost reference in the REST API...it simply wasn't clear
to me how to do the same thing in the Java API. I looked at the
QueryStringBuilder, but just missed the field(String, float) method.

Mike

On Mar 24, 5:04 pm, Shay Banon shay.ba...@elasticsearch.com wrote:

Few things:

  1. You can define boost at index time for field, when you search on the _all field, if there is a match for that field content, it will be boosted.

  2. You can use the query_string and provide the list of fields you wish to search on, each with different boost levels (QueryStringBuilder#field(String field, float boost).

A note, that I keep repeating and its in the docs, not sure why people keep missing it. The REST API is built on top of the Java API. There is no way to have something exposed in REST that is not exposed (in some way) using the Java API.

On Thursday, March 24, 2011 at 10:53 PM, Mike Brocious wrote:

It's not clear to me how I can boost a specific field on the query
using the Java API. Basically, I'd like to do a query string search
across all fields and boost one of the fields so that if the search
string is found in that field, those documents will be ranked higher.

Is this possible using the Java API?

Thanks.

Mike

No problem, thats what the mailing list is for :slight_smile:
On Friday, March 25, 2011 at 2:38 AM, Mike Brocious wrote:

Thanks, Shay. Appreciate your patience with us as we come up to speed
on ES.

I found the boost reference in the REST API...it simply wasn't clear
to me how to do the same thing in the Java API. I looked at the
QueryStringBuilder, but just missed the field(String, float) method.

Mike

On Mar 24, 5:04 pm, Shay Banon shay.ba...@elasticsearch.com wrote:

Few things:

  1. You can define boost at index time for field, when you search on the _all field, if there is a match for that field content, it will be boosted.

  2. You can use the query_string and provide the list of fields you wish to search on, each with different boost levels (QueryStringBuilder#field(String field, float boost).

A note, that I keep repeating and its in the docs, not sure why people keep missing it. The REST API is built on top of the Java API. There is no way to have something exposed in REST that is not exposed (in some way) using the Java API.

On Thursday, March 24, 2011 at 10:53 PM, Mike Brocious wrote:

It's not clear to me how I can boost a specific field on the query
using the Java API. Basically, I'd like to do a query string search
across all fields and boost one of the fields so that if the search
string is found in that field, those documents will be ranked higher.

Is this possible using the Java API?

Thanks.

Mike